I'm working on an application which have a button to open a SaveFileDialog to create a simple file on the device. It's working on my computer and I tried it on two other devices where it's working too. Somehow on my colleague's device the application is crashing when he clicks on the button to open the SaveFileDialog. On my device and the other two tested devies there is no exception error thrown or showing when I'm doing this. I can't reproduce the error. Is there any known bug for SaveFileDialogs or does anybody have a hint what problem this could be?
Some code:
SaveFileDialog exportGridDialog = new SaveFileDialog
{
Filter = "Excel File|*.xlsx",
Title = (string)Application.Current.FindResource("Dialog_Title_ExportToFile")
};
if (exportGridDialog.ShowDialog() == true)
{
...
}
It is very simple code so I don't understand why it is not working. The error occurs when he clicks on the button and the SaveFileDialog will be shown, but then there comes a message "The program has been closed due to problems...". Nothing special information. Then the application closes.
Edit: the eventlog of windows shows that this is a KERNELBASE.DLL error with exception code 0xc0000005, error offset? = 0x000000000003a799
Try putting a try/catch block around your code and report a MessageBox with the error message details, then debug from there.
try
{
SaveFileDialog exportGridDialog = new SaveFileDialog
{
Filter = "Excel File|*.xlsx",
Title = (string)Application.Current.FindResource("Dialog_Title_ExportToFile")
};
if (exportGridDialog.ShowDialog() == true)
{
...
}
}
catch (Exception ex)
{
MessageBox.Show($"{ex.GetType()}\n{ex.Message}\n{ex.StackTrace}");
}
User contributions licensed under CC BY-SA 3.0