static void CurrentDomain_UnhandledException (object sender, UnhandledExceptionEventArgs e) { try { var customEx = new ErrorManager(); Exception ex = customEx.GetExceptionDetail((Exception)e.ExceptionObject); MessageBox.Show(ex.Message, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { Application.Exit(); } }
public static void Application_ThreadException (object sender, System.Threading.ThreadExceptionEventArgs e) { DialogResult result = DialogResult.Abort; try { var customEx = new ErrorManager(); Exception ex = customEx.GetExceptionDetail(e.Exception); result = MessageBox.Show(ex.Message, "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { Application.Exit(); } }