private static void OnUnhandledException(UnhandledExceptionArgs args) { Log.Fatal("Unhandled Exception.", (Exception)args.ExceptionObject); Console.WriteLine("Fatal Error: {0} ... {1}", args.ExceptionObject, args.IsTerminating); MessageBox.Show(new FatalErrorWindow(), "Unhandled exception.\n" + "Please raise an issue on the Support website.", ButtonsType.Ok, MessageType.Error); args.ExitApplication = true; }
private static void OnUnhandledException(UnhandledExceptionArgs args) { if (exceptionHandler != null) { exceptionHandler(args); } else { args.ExitApplication = true; } }
/* Private members */ ///// <summary>Kills the window in the most quick and unfriendly way.</summary> //private static void Kill () { // try { // Base.Kill(); // } // catch (Exception) { // ; //Nothing to do if there were errors while killing the window // } //} /* Event members */ private static void OnUnhandledException(UnhandledExceptionArgs args) { if (args.ExceptionObject is Exception) { BugReporter.Report(args.ExceptionObject as Exception); throw new Exception("Unhandled Exception", args.ExceptionObject as Exception); } throw new Exception("Unhandled Exception with no inner exception"); //Kill(); }
static void ExceptionManager_UnhandledException(UnhandledExceptionArgs args) { Exception exception = args.ExceptionObject as Exception; if (exception == null) { exception = new Exception("Unknown exception"); } Utilities.ShowApplicationException(exception); // args.ExitApplication = true; }
static void HandleUnhandledException(UnhandledExceptionArgs args) { Exception ex = (Exception)args.ExceptionObject; MessageDialog msgDialog = new MessageDialog( null, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, "Message: {0}\n\n Stacktrace: {1}", ex.Message, ex.StackTrace); msgDialog.Run(); msgDialog.Destroy(); args.ExitApplication = true; }
private static void ExceptionManager_UnhandledException(UnhandledExceptionArgs e) { var show = _ShowErrorMessage; var ex = e.ExceptionObject as Exception; var title = e.IsTerminating ? "异常退出" : "出错"; if (show) { var md = new MessageDialog(_window, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.None, ex?.Message); md.Run(); md.Dispose(); } }
// Ошибка -> Исключение Lab5Exception -> UnhandledException : Lab5Exception -> // ExceptionManager -> HandleException (struct args { UnhandledException }) -> // ExceptionObject == UnhandledException -> InnerException -> Lab5Exception static void HandleException(UnhandledExceptionArgs args) { var exception = new Exception(); exception.SetText(((System.Exception)args.ExceptionObject).InnerException.Message); var response = (ResponseType)exception.Run(); switch (response) { case ResponseType.DeleteEvent: case ResponseType.Ok: exception.Destroy(); break; } }
/// <summary> /// Passes any unhandled exceptions from the GTK UI to the generic handler. /// </summary> /// <param name="args">The event object containing the information about the exception.</param> private static void OnGLibUnhandledException(UnhandledExceptionArgs args) { if (args.ExceptionObject is Exception unhandledException) { //TODO: Caso haja algum erro na construção do host, o ServiceProvider virá como nulo var dialog = new Dialog("Error", ServiceProvider.GetService <MainWindow>(), DialogFlags.Modal | DialogFlags.DestroyWithParent, "Okay", ResponseType.Ok); ((Box)dialog.Child).Add(new Label(unhandledException.Message)); dialog.ShowAll(); dialog.Run(); //dialog.Destroy(); dialog.Dispose(); } }
void HandleExceptionManagerUnhandledException(UnhandledExceptionArgs args) { Exception ex = (Exception)args.ExceptionObject; Console.WriteLine("Unhandled Exception: {0}", ex.GetType().ToString()); Console.WriteLine("\t{0}", ex.Message); Console.WriteLine("\t{0}", ex.Source); Console.WriteLine("\t{0}", ex.StackTrace); MessageDialog d = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, true, "<b>{0}</b>: {1} at <i>{2}</i>", ex.GetType().ToString(), ex.Message, ex.Source); d.Run(); d.Hide(); d.Dispose(); args.ExitApplication = true; }
private void ExceptionManagerUnhandledException(UnhandledExceptionArgs args) { args.ExitApplication = false; try { string message; var exception = args.ExceptionObject as Exception; if (exception != null) { if (exception.InnerException != null) { exception = exception.InnerException; } message = exception.Message + "\n" + exception.StackTrace; } else { message = args.ExceptionObject.ToString(); } message = Markup.EscapeText(message); var dialog = new MessageDialog( this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, message); dialog.Run(); dialog.Destroy(); } catch { } }
/// <summary> /// Passes any unhandled exceptions from the GTK UI to the generic handler. /// </summary> /// <param name="args">The event object containing the information about the exception.</param> private static void OnGLibUnhandledException(UnhandledExceptionArgs args) { OnUnhandledException(null, args); }
private static void OnUnhandledException(UnhandledExceptionArgs args) { System.Diagnostics.Debug.WriteLine($"Unhandled GTK# exception: {args.ExceptionObject}"); }
private void HandleUnhandledException(UnhandledExceptionArgs args) { this.HandledException(args.ExceptionObject as Exception); }
private static void HandleUnhandledException(UnhandledExceptionArgs args) { UserStatisticsFactory.HandledException(args.ExceptionObject as Exception); }
void OnException(object o, UnhandledExceptionArgs args) { }
static void Exception_aru(UnhandledExceptionArgs args) { Console.WriteLine(args); //throw new System.Exception (args.ToString ()); }