B2019-098: Upon error and clicking ok on error dialog, the next dialog, for how to close, loops
This commit is contained in:
@@ -22,17 +22,17 @@ namespace VEPROMS
|
||||
AttachConsole(ATTACH_PARENT_PROCESS);
|
||||
if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().EndsWith("vshost"))
|
||||
{
|
||||
Application.Run(new frmVEPROMS());
|
||||
Application.Run(_myForm = new frmVEPROMS());
|
||||
}
|
||||
else
|
||||
{
|
||||
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
|
||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
Application.Run(new frmVEPROMS());
|
||||
Application.Run(_myForm = new frmVEPROMS());
|
||||
}
|
||||
}
|
||||
|
||||
static frmVEPROMS _myForm = null; // B2019-098: prevent looping between error & exit dialog
|
||||
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
_log.Error("PROMS2010 Main UnhandledException", e.ExceptionObject as Exception);
|
||||
@@ -68,6 +68,7 @@ namespace VEPROMS
|
||||
string msg = string.Format("An error has occurred so the program will terminate. Please send the error log, {0}, to Volian.",dpath);
|
||||
if(!System.Environment.CommandLine.Contains("/P="))
|
||||
MessageBox.Show(msg);
|
||||
_myForm.ClosingWithError = true;
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user