示例#1
0
        private static void ProcessUnhandled(Exception ex, bool isFatal)
        {
            var log = AppContext.Instance.Get <ILog>();

            log.Error(isFatal ? "Fatal" : "Unhandled", ex);
            var errorForm = new ErrorReportingForm(new ErrorReportingFormArgs
            {
                Exception = ex,
                IsFatal   = isFatal,
                LogFile   = log.Destination
            });

            errorForm.ShowDialog(_mainForm);
        }
示例#2
0
文件: Program.cs 项目: uzbekdev1/main
 private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
 {
     try
     {
         if (e.Exception.Message.IndexOf("NoDriver") != -1)
         {
             //USB audio plugged/ unplugged (typically the cause) - no other way to catch this exception in the volume level control due to limitation in NAudio
         }
         else
         {
             if (MainForm.Conf.Enable_Error_Reporting && _reportedExceptionCount == 0 &&
                 e.Exception != null && e.Exception.Message.Trim() != "")
             {
                 if (_er == null)
                 {
                     _er = new ErrorReportingForm {
                         UnhandledException = e.Exception
                     };
                     _er.ShowDialog();
                     _er.Dispose();
                     _er = null;
                     _reportedExceptionCount++;
                 }
             }
         }
         Log.Error("", e.Exception);
     }
     catch (Exception ex2)
     {
         try
         {
             Log.Error("", ex2);
         }
         catch
         {
         }
     }
 }