Exemple #1
0
 /// <summary>
 /// UI线程抛出全局异常事件处理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
 {
     try
     {
         OliveLogger.Error("UI线程全局异常", e.Exception);
         e.Handled = true;
     }
     catch (Exception ex)
     {
         OliveLogger.Error("不可恢复的UI线程全局异常", ex);
     }
 }
Exemple #2
0
 /// <summary>
 /// 非UI线程抛出全局异常事件处理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     try
     {
         var exception = e.ExceptionObject as Exception;
         if (exception != null)
         {
             OliveLogger.Error("非UI线程全局异常", exception);
         }
     }
     catch (Exception ex)
     {
         OliveLogger.Error("不可恢复的非UI线程全局异常", ex);
     }
 }