void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { // In debug mode do not custom-handle the exception, let Visual Studio handle it e.Handled = false; //want to save and send the error out before the project crashes. ErrorViewModel.Save(e.Exception, e.GetType(), ErrorGroupEnum.Threading, additionalInformation: Logger.Instance.getLoggedMessages()); ErrorViewModel.checkForOldErrors(); ShowUnhandeledException(e); }
protected override void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { e.Handled = true; //var windowManager = IoC.Get<IWindowManager>(); Execute.OnUIThread(() => { var result = MessageBox.Show("An error occured, the application will exit.\n " + "Do you want to view the error details?", "Error occured", MessageBoxButton.YesNo, MessageBoxImage.Error); if (result == MessageBoxResult.Yes) { MessageBox.Show(e.Exception.Message, e.GetType().Name, MessageBoxButton.OK, MessageBoxImage.Error); Application.Shutdown(); } }); Application.Shutdown(); base.OnUnhandledException(sender, e); }