Yaircc.Program.CurrentDomain_UnhandledException C# (CSharp) Метод

CurrentDomain_UnhandledException() публичный статический Метод

Handles unhandled exceptions within the application.
public static CurrentDomain_UnhandledException ( object sender, UnhandledExceptionEventArgs e ) : void
sender object The source of the event.
e System.UnhandledExceptionEventArgs The event arguments.
Результат void
        public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                Exception ex = e.ExceptionObject as Exception;
                DialogResult result = MessageBox.Show(Strings_General.BugReportRequest, "Doh!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (result == DialogResult.Yes)
                {
                    ErrorLog log = new ErrorLog(ex);
                    XmlSerializer serializer = new XmlSerializer(typeof(ErrorLog));
                    using (TextWriter writer = new StringWriter())
                    {
                        serializer.Serialize(writer, log);
                        PostErrorLog(writer.ToString());
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                Environment.Exit(1);
            }
        }