Esempio n. 1
0
 // Handling a ThreadException leaves the application in an undefined state.
 // See https://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception(v=vs.100).aspx
 // Log the exception, ask the user to report it, and exit.
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     try
     {
         WriteLine($"\n==== UNHANDLED UI EXCEPTION ====\n{e.Exception.ToString()}\n==== cut ====");
         ExceptionForm.ShowException(e.Exception, "There was an unhandled UI exception.", urlfeedback);
     }
     catch
     {
     }
 }
Esempio n. 2
0
        public static DialogResult ShowException(Exception ex, string desc, string reportIssueURL, bool isFatal = false, Form parent = null)
        {
            ExceptionForm f = new ExceptionForm(ex, desc, reportIssueURL, isFatal)
            {
                Owner         = parent,
                StartPosition = parent != null ? FormStartPosition.CenterParent : FormStartPosition.WindowsDefaultLocation
            };
            DialogResult res = f.ShowDialog(parent);

            if (isFatal || res != DialogResult.Ignore)
            {
                Environment.Exit(1);
            }
            return(res);
        }
Esempio n. 3
0
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                WriteLine($"\n==== UNHANDLED EXCEPTION ====\n{e.ExceptionObject.ToString()}\n==== cut ====");
                WriteLine(null);
                LogLineQueueEvent.WaitOne(100);
                ExceptionForm.ShowException(e.ExceptionObject as Exception, "An unhandled fatal exception has occurred.", urlfeedback, isFatal: true);
            }
            catch
            {
            }

            Environment.Exit(1);
        }
Esempio n. 4
0
        // Handling a ThreadException leaves the application in an undefined state.
        // See https://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception(v=vs.100).aspx
        // Log the exception, ask the user to report it, and exit.
        private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            try
            {
                TraceLog.WriteLine($"\n==== UNHANDLED UI EXCEPTION ====\n{e.Exception.ToString()}\n==== cut ====");

                // Ignore COM exceptions in Web Browser component
                if (e.Exception is System.Runtime.InteropServices.COMException && e.Exception.StackTrace.Contains("System.Windows.Forms.UnsafeNativeMethods.IWebBrowser2.Navigate2"))
                {
                    return;
                }

                ExceptionForm.ShowException(e.Exception, "There was an unhandled UI exception.", urlfeedback);
            }
            catch
            {
            }
        }