Just a quick question.
I can get a form to show with other exceptions, but with the type I'm asking about, I get the system "application is no longer working" dialog:
Program.cs:
#if !DEBUG
// Add the event handler for handling UI thread exceptions to the event.
Application.ThreadException += new ThreadExceptionEventHandler(Logging.Application_ThreadException);
// Set the unhandled exception mode to force all Windows Forms errors to go through our handler.
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
// Add the event handler for handling non-UI thread exceptions to the event.
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Logging.CurrentDomain_UnhandledException);
#endif
throw new Exception();
Logging.cs:
public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
ExceptionHandler((Exception)e.ExceptionObject, true);
}
private static void ExceptionHandler(Exception e, bool isFatal)
{
LogException(e, isFatal);
//if (!isFatal)
//{
FormException formException = new FormException(isFatal);
formException.Show();
//}
//else // It seems that showing a form when you have an unhandled exception isn't a good idea...
//{
// MessageBox.Show("Crashed",
// Program.Name,
// MessageBoxButtons.OK,
// MessageBoxIcon.Stop);
// Program.Exit();
//}
}