示例#1
0
        public static void AppDomain_CurrentDomain(object sender, UnhandledExceptionEventArgs x)
        {
            WriteToLog.Log("An unhandled exception was thrown", "UNHANDLEDEXCEPTION");
            var ex = (Exception)x.ExceptionObject;

            WriteToLog.Log(ex.Message, "UNHANDLEDEXCEPTION");
            WriteToLog.Log(ex.StackTrace, "UNHANDLEDEXCEPTION");
        }
示例#2
0
 /// <summary>
 /// Write to the log file on a crash
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
 {
     if (e.Exception.Message.Contains("too small for an Int32") || e.Exception.Message.Contains("Constructor on type "))
     {
         return;
     }
     WriteToLog.Log("A first chance exception was thrown", "EXCEPTION");
     WriteToLog.Log(e.Exception.Message, "EXCEPTION");
     WriteToLog.Log(e.Exception.StackTrace, "EXCEPTION");
 }
示例#3
0
 /// <summary>
 ///     Write to the log file on a crash
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void CurrentDomain_FirstChanceException(object sender, FirstChanceExceptionEventArgs e)
 {
     try
     {
         if (e.Exception.Message.Contains("too small for an int") ||
             e.Exception.Message.Contains("Constructor on type "))
         {
             return;
         }
     }
     catch
     {
         WriteToLog.Log("Failed to write error in FirstChanceException.");
         return;
     }
     WriteToLog.Log("A first chance exception was thrown", "EXCEPTION");
     WriteToLog.Log(e.Exception.Message, "EXCEPTION");
     WriteToLog.Log(e.Exception.StackTrace, "EXCEPTION");
 }
示例#4
0
 public static void Application_ThreadException(object sender, ThreadExceptionEventArgs t)
 {
     WriteToLog.Log("An unhandled exception was thrown", "ThreadException");
     WriteToLog.Log(t.Exception.Message, "ThreadException");
     WriteToLog.Log(t.Exception.StackTrace, "ThreadException");
 }