private static void OnDomainUnhandledException(object sender, System.UnhandledExceptionEventArgs e) { if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debugger.Break(); } OSDispatcher.Current.InvokeOnMainDispatcher(() => ReportDomainUnhandledException(e.ExceptionObject as System.Exception)); }
private void AppDomainUnhandledException(object sender, System.UnhandledExceptionEventArgs e) { if (System.Windows.Application.Current != null) { if ((System.Windows.Application.Current.MainWindow as DslEditorMainWindow) != null) { HandleException(e.ExceptionObject as System.Exception, (System.Windows.Application.Current.MainWindow as DslEditorMainWindow).DocData); } } }
private static void HandleUnhandledException(object sender, System.UnhandledExceptionEventArgs args) { if (args == null || args.ExceptionObject == null) { return; } if (args.ExceptionObject.GetType() == typeof(System.Exception)) { System.Exception e = (System.Exception)args.ExceptionObject; OnLogHandler(string.Format("Unhandled Exception at {0}", e.Source), e.StackTrace, LogType.Exception); } }
private static void OnDomainUnhandledException(object sender, System.UnhandledExceptionEventArgs e) { if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debugger.Break(); } if (NSThread.IsMain) { ReportDomainUnhandledException(e.ExceptionObject as System.Exception); } else { Current.BeginInvokeOnMainThread(() => ReportDomainUnhandledException(e.ExceptionObject as System.Exception)); } }
static void ExceptionHandler(object sender, System.UnhandledExceptionEventArgs args) { System.Exception e = (System.Exception)args.ExceptionObject; string exceptionData = e.Message + System.Environment.NewLine + e.StackTrace; byte[] outputData = System.Text.Encoding.ASCII.GetBytes(exceptionData); // do not dump or close if in a debugger. if (!System.Diagnostics.Debugger.IsAttached) { System.IO.FileStream fileStream = System.IO.File.OpenWrite(Els_kom_Core.Classes.SettingsFile.ErrorLogPath); fileStream.Write(outputData, 0, outputData.Length); fileStream.Dispose(); Els_kom_Core.Classes.MiniDump.FullMiniDumpToFile(Els_kom_Core.Classes.SettingsFile.MiniDumpPath); System.Windows.Forms.MessageBox.Show("Please send a copy of " + Els_kom_Core.Classes.SettingsFile.ErrorLogPath + " to https://github.com/Elskom/Els_kom_new/issues by making an issue and attaching the log(s) and mini-dump(s).", "Unhandled Exception!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); System.Windows.Forms.Application.Exit(); } }
static void UnhandledExceptionCallback(object sender, System.UnhandledExceptionEventArgs args) { if (_sent) { return; } if (args == null || args.ExceptionObject == null) { return; } System.Exception e = args.ExceptionObject as System.Exception; if (e != null) { _sent = true; AddData("type", "crash"); AddData("name", e.GetType().ToString()); AddData("message", e.Message); AddData("sender", "UnhandledExceptionCallback" + sender.ToString()); AddData("stack", StackTrace(e)); Coroutines.Run(SendBugReport()); } }
/// <summary> /// This is called when unhandled exception happened. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void CurrentDomain_UnhandledException(object sender, System.UnhandledExceptionEventArgs e) { //System.Windows.Forms.MessageBox.Show("Error: " + ((Exception)e.ExceptionObject).ToString(), "Error:", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); System.Console.WriteLine("Error: " + ((System.Exception)e.ExceptionObject).ToString(), "Error:"); }
private static void CurrentDomain_UnhandledException(object sender, System.UnhandledExceptionEventArgs ex) { Externs.MessageBox("Error!", ex.ExceptionObject.ToString()); }
} // End Sub CurrentDomain_ProcessExit // Catch unhandled exceptions private static void CurrentDomain_UnhandledException(object sender, System.UnhandledExceptionEventArgs e) { System.Console.WriteLine(((System.Exception)e.ExceptionObject).Message, "Error"); OnExit(); } // End Sub CurrentDomain_UnhandledException
private static void HandleUnhandledExceptionEvent(Object sender, System.UnhandledExceptionEventArgs e) { //write details to file or output to console, popup message, etc. }