Ensure application exits on unhandled UI thread exceptions
This commit is contained in:
parent
7937902043
commit
75fe114a8c
1 changed files with 9 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ using System.ServiceModel;
|
|||
using System.ServiceModel.Description;
|
||||
using System.Threading;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SettingsManagement;
|
||||
|
|
@ -147,6 +148,13 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
_raygunClient.Send(e.Exception);
|
||||
}
|
||||
|
||||
if (System.Windows.Forms.Application.OpenForms.Count > 0
|
||||
&& !System.Windows.Forms.Application.OpenForms[0].InvokeRequired)
|
||||
{
|
||||
System.Windows.Forms.Application.Exit();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
|
||||
|
|
@ -155,6 +163,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
_raygunClient.Send(e.ExceptionObject as Exception);
|
||||
}
|
||||
System.Windows.Forms.Application.Exit();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue