so I'm trying to save an image via this code:
SaveFileDialog saveFileDialogThing = new SaveFileDialog();
Bitmap test = new Bitmap(5, 5);
//Do some image edit thingies
try
{
if(saveFileDialogThing.ShowDialog() == DialogResult.OK){
test.Save(saveFileDialogThing.FileName);
}
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
When running in Debug configuration, everything works as intended. However, when running in Release configuration, it doesn't save the file and instead crashes with
The program '[19656] Cool Program.exe' has exited with code -2147483645 (0x80000003).
, without even catching whatever exception may be causing this, if any. What gives?
This also happens when trying to open an image like so:
Bitmap imgIn;
OpenFileDialog openFileDialogTest = new OpenFileDialog();
openFileDialogTest.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
openFileDialogTest.Filter = "Image files (*.png)|*.png";
openFileDialogTest.FilterIndex = 2;
openFileDialogTest.RestoreDirectory = true;
if (openFileDialogTest.ShowDialog() == DialogResult.OK)
{
filePath = openFileDialogTest.FileName;
imgIn = new Bitmap(filePath);
}
Can anyone help me with this?
Regards,
radzo73
User contributions licensed under CC BY-SA 3.0