Esempio n. 1
0
 private static void UIThreadException(object sender, ThreadExceptionEventArgs t)
 {
     //DialogResult result = DialogResult.Cancel;
     //try
     //{
     //    result = ShowThreadExceptionDialog("Windows Forms Error", t.Exception);
     //}
     //catch
     //{
     //    try
     //    {
     //        MessageBox.Show("Fatal Windows Forms Error",
     //            "Fatal Windows Forms Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
     //    }
     //    finally
     //    {
     //        Application.Exit();
     //    }
     //}
     //// Exits the program when the user clicks Abort.
     //if (result == DialogResult.Abort)
     //    Application.Exit();
     OLEREO.Control.EmailContact.erroReport("严重的错误:" + "\r\n\r\n"
                                            + t.Exception + "\r\n\r\n"
                                            + t.Exception.Message + "\r\n\r\n"
                                            + t.Exception.StackTrace + "\r\n\r\n"
                                            + t.ToString(), "严重的错误", "程序发了一个严重的未知错误,您愿意将该错误的信息发送给我,以便我改进此错误吗?", false);
     Application.Exit();
 }
Esempio n. 2
0
        /// <summary>
        /// 异常处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Application_ThradException(object sender, ThreadExceptionEventArgs e)
        {
            string str = GetExceptionMsg(e.Exception, e.ToString());

            RunError(str);
            Environment.Exit(0);
        }
Esempio n. 3
0
        //*******************************************************************
        // method: Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        // description: Custom Exception for DictEdit class
        //              kills the running process and throws up a message box
        // returns:void
        //*******************************************************************
        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            DialogResult result;
            DateTime     dt = new DateTime();

            result = MessageBox.Show("Unhandled Thread Exception", "An error has occurred causing the process to end.\n Would you like to restart Dictionary Editor?",
                                     MessageBoxButtons.YesNo);

            // Starts new process and kills old one when the user clicks Yes.
            if (result == DialogResult.Yes)
            {
                Process.Start(Process.GetCurrentProcess().ProcessName);
                Process.GetCurrentProcess().Kill();
            }

            //Write exception data to file
            string executableLocation = Path.GetDirectoryName(
                Assembly.GetExecutingAssembly().Location);                     //Get path to Debug folder
            string logPath = Path.Combine(executableLocation, "ErrorLog.txt"); //Slap the filename on the path

            //Make the filestream object
            using (FileStream errorFile = new FileStream(logPath, FileMode.Append, FileAccess.Write))
                //Make the streamwriter
                using (StreamWriter sw = new StreamWriter(errorFile))
                {
                    sw.WriteLine(e.ToString());
                    sw.WriteLine("Date: " + dt.Date.ToString());
                    sw.WriteLine("Time: " + dt.TimeOfDay.ToString());
                    sw.WriteLine("----------------------------------------------------------");
                }
        }
Esempio n. 4
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     Log.Error("Unhandled thread exception: " + e.ToString());
     MessageBox.Show(sender.ToString() + "\n" + e.Exception.Message, "Unhandled Thread Exception");
     //throw e.Exception;
     salir_Click(null, null);
 }
Esempio n. 5
0
        private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            string str = GetExceptionMsg(e.Exception, e.ToString());

            OSSHelper.shard.upLoadLog(str);
            Logger.Error(e.Exception as Exception, str);
        }
Esempio n. 6
0
        private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            string str = LoggerUtils.GetExceptionMsg(e.Exception, e.ToString());

            MessageBox.Show(str, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            LoggerUtils.Error(str);
        }
Esempio n. 7
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     try
     {
         Log.Error(e.ToString());
     }
     catch { }
 }
Esempio n. 8
0
        private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            string str = GetExceptionMsg(e.Exception, e.ToString());

            MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            GlobleVariable.ErrorLogger.Error(e.Exception.Message + e.Exception.StackTrace);
            Application.Exit();
            Application.ExitThread();
            System.Environment.Exit(0);
        }
Esempio n. 9
0
        private static void CatchThreadException(object sender, ThreadExceptionEventArgs e)
        {
            string exceptionMsg = GetExceptionMsg(e.Exception, e.ToString());

            MessageBox.Show(exceptionMsg, ecodsra102(0), MessageBoxButtons.OK, MessageBoxIcon.Hand);
            if (Excall != null)
            {
                Excall(exceptionMsg);
            }
        }
Esempio n. 10
0
 /// <summary>Catches all unhandled exceptions within the current UI thread</summary>
 internal static void UIThreadException(object sender, ThreadExceptionEventArgs t)
 {
     try
     {
         MessageBox.Show("Unhandled Windows Forms Exception");
         LogCrash(t.ToString());
     }
     catch (Exception exc)
     {
         try
         {
             MessageBox.Show("A fatal exception occured inside the UIThreadException handler",
                             "Fatal Windows Forms Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
             LogCrash(exc.ToString());
         }
         finally
         {
             Environment.Exit(0);
         }
     }
     Environment.Exit(0);
 }
Esempio n. 11
0
        /// <summary>
        /// Recupera exceções ocorridas na thread principal e realiza o log delas
        /// </summary>
        private static void ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            try
            {
                int    ext = 1;
                string filename;

                while (true)
                {
                    filename  = "ErrorLog [" + DateTime.Now.ToShortDateString() + "]";
                    filename  = filename.Replace('/', '-').Replace('\\', '-');
                    filename += ext != 1
                        ? " (" + ext + ")"
                        : string.Empty;
                    if (!File.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\" + filename + ".log"))
                    {
                        break;
                    }
                    ++ext;
                }

                filename = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + filename + ".log";
                using (StreamWriter fs = File.CreateText(filename))
                {
                    fs.WriteLine(Application.ProductName + " " + Application.ProductVersion);
                    fs.WriteLine(DateTime.Now.ToLongDateString() + " at " + DateTime.Now.ToLongTimeString());
                    fs.WriteLine();
                    fs.WriteLine(e.ToString());
                }
            }
            finally
            {
                // Relança exceção fechando a aplicação
                throw e.Exception;
            }
        }
Esempio n. 12
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     ComeCommonMethod.LogFunction.WritePrivateProfileString(
         "Application_ThreadException", e.Exception.ToString(), e.ToString(), Environment.CurrentDirectory + "\\Application.ini");
 }
Esempio n. 13
0
 public static void Write(ThreadExceptionEventArgs e)
 {
     Trace.WriteLine(PrintTime() + e.ToString());
 }
Esempio n. 14
0
 private static void OnException(object sender, ThreadExceptionEventArgs args)
 {
     CMSG(args.ToString());
     Sentry.SentrySdk.CaptureException(args.Exception);
 }
Esempio n. 15
0
 public static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     Log.Write("Exception in setuptv");
     Log.Write(e.ToString());
     Log.Write(e.Exception);
 }
Esempio n. 16
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show(e.ToString(), "Unhandled Thread Exception");
     // here you can log the exception ...
 }
Esempio n. 17
0
 static void HandleThreadException(object sender, ThreadExceptionEventArgs e)
 {
     LocalStaticLogger.WriteLine(e.ToString());
 }
Esempio n. 18
0
 static void ExceptionHandler(object sender, ThreadExceptionEventArgs ex)
 {
     MessageBox.Show(ex.ToString());
 }
Esempio n. 19
0
 void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(e.ToString());
     //throw new NotImplementedException();
 }
Esempio n. 20
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show(e.ToString());
 }
Esempio n. 21
0
 public void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     textBoxMessages.Text += e.ToString();
 }
Esempio n. 22
0
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     Logs.WriteLog("FATAL ERROR", e.ToString(), Core.LogLevel.Fatal);
 }
Esempio n. 23
0
 private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
 {
     //MessageBox.Show("ThreadException" + e.ToString());
     System.Console.WriteLine("ThreadException" + e.ToString());
 }
Esempio n. 24
0
 // Event handler for thread abort
 public void OnThreadException(object sender, ThreadExceptionEventArgs te)
 {
     appendText(te.ToString() + "\n");
     StopMonitoring();
 }
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show(GetExceptionMsg(e.Exception, e.ToString()), "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
 }
Esempio n. 26
0
 private static void ThreadExceptionHandle(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show("ThreadExceptionHandle" + e.ToString());
 }
Esempio n. 27
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     Log.e(String.Format("Application_ThreadException: sender={0}, e={1}", sender.ToString(),e.ToString()));
 }