Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 3
0
        /* 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();
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        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();
            }
        }
Ejemplo n.º 7
0
        // Ошибка -> Исключение 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;
            }
        }
Ejemplo n.º 8
0
        /// <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();
            }
        }
Ejemplo n.º 9
0
        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
            {
            }
        }
Ejemplo n.º 11
0
 /// <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);
 }
Ejemplo n.º 12
0
 private static void OnUnhandledException(UnhandledExceptionArgs args)
 {
     System.Diagnostics.Debug.WriteLine($"Unhandled GTK# exception: {args.ExceptionObject}");
 }
Ejemplo n.º 13
0
 private void HandleUnhandledException(UnhandledExceptionArgs args)
 {
     this.HandledException(args.ExceptionObject as Exception);
 }
Ejemplo n.º 14
0
 private static void HandleUnhandledException(UnhandledExceptionArgs args)
 {
     UserStatisticsFactory.HandledException(args.ExceptionObject as Exception);
 }
Ejemplo n.º 15
0
 void OnException(object o, UnhandledExceptionArgs args)
 {
 }
Ejemplo n.º 16
0
 static void Exception_aru(UnhandledExceptionArgs args)
 {
     Console.WriteLine(args);
     //throw new System.Exception (args.ToString ());
 }