private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { LogWriter.Log(e.Exception, "On Dispacher Unhandled Exception - Unknown"); try { ExceptionDialog.Ok(e.Exception, "ScreenToGif - Translator", "Unhandled exception", e.Exception.Message); } catch (Exception ex) { LogWriter.Log(ex, "Error while displaying the error."); //Ignored. } e.Handled = true; }
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { if (!(e.ExceptionObject is Exception exception)) { return; } LogWriter.Log(exception, "Current Domain Unhandled Exception - Unknown"); try { ExceptionDialog.Ok(exception, "ScreenToGif - Translator", "Unhandled exception", exception.Message); } catch (Exception) { //Ignored. } }