Exemplo 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();
 }
Exemplo 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);
        }
Exemplo 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("----------------------------------------------------------");
                }
        }
Exemplo 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);
 }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 7
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     try
     {
         Log.Error(e.ToString());
     }
     catch { }
 }
Exemplo 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);
        }
Exemplo 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);
            }
        }
Exemplo 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);
 }
Exemplo 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;
            }
        }
Exemplo 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");
 }
Exemplo n.º 13
0
 public static void Write(ThreadExceptionEventArgs e)
 {
     Trace.WriteLine(PrintTime() + e.ToString());
 }
Exemplo n.º 14
0
 private static void OnException(object sender, ThreadExceptionEventArgs args)
 {
     CMSG(args.ToString());
     Sentry.SentrySdk.CaptureException(args.Exception);
 }
Exemplo 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);
 }
Exemplo n.º 16
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show(e.ToString(), "Unhandled Thread Exception");
     // here you can log the exception ...
 }
Exemplo n.º 17
0
 static void HandleThreadException(object sender, ThreadExceptionEventArgs e)
 {
     LocalStaticLogger.WriteLine(e.ToString());
 }
Exemplo n.º 18
0
 static void ExceptionHandler(object sender, ThreadExceptionEventArgs ex)
 {
     MessageBox.Show(ex.ToString());
 }
Exemplo n.º 19
0
 void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(e.ToString());
     //throw new NotImplementedException();
 }
Exemplo n.º 20
0
 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show(e.ToString());
 }
Exemplo n.º 21
0
 public void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     textBoxMessages.Text += e.ToString();
 }
Exemplo n.º 22
0
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     Logs.WriteLog("FATAL ERROR", e.ToString(), Core.LogLevel.Fatal);
 }
Exemplo n.º 23
0
 private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
 {
     //MessageBox.Show("ThreadException" + e.ToString());
     System.Console.WriteLine("ThreadException" + e.ToString());
 }
Exemplo n.º 24
0
 // Event handler for thread abort
 public void OnThreadException(object sender, ThreadExceptionEventArgs te)
 {
     appendText(te.ToString() + "\n");
     StopMonitoring();
 }
Exemplo n.º 25
0
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show(GetExceptionMsg(e.Exception, e.ToString()), "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
 }
Exemplo n.º 26
0
 private static void ThreadExceptionHandle(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show("ThreadExceptionHandle" + e.ToString());
 }
Exemplo 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()));
 }