From d7f94fa99fac31f5e5afd453ea6300c34b7bf52c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 6 Jun 2018 23:22:51 -0500 Subject: [PATCH] Add a default exception handler. The default Windows one doesn't always show a message properly. --- smx-config/App.xaml.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/smx-config/App.xaml.cs b/smx-config/App.xaml.cs index 105c0ee..24ac412 100644 --- a/smx-config/App.xaml.cs +++ b/smx-config/App.xaml.cs @@ -13,11 +13,19 @@ namespace smx_config App() { + AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionEventHandler; + if(Helpers.GetDebug()) SMX_Internal_OpenConsole(); CurrentSMXDevice.singleton = new CurrentSMXDevice(); } + private void UnhandledExceptionEventHandler(object sender, UnhandledExceptionEventArgs e) + { + string message = e.ExceptionObject.ToString(); + MessageBox.Show("SMXConfig encountered an unexpected error:\n\n" + message, "SMXConfig"); + } + protected override void OnExit(ExitEventArgs e) { base.OnExit(e);