Example #1
0
        private static void Application_UnhandledException(
            object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            var ex = e.ExceptionObject;

            AnalyticsTracker.Track(
                new TrackingEvent("error")
                {
                    {"type", ex.GetType().FullName},
                    {"stack", ex.StackTrace}
                });

            if (!Debugger.IsAttached)
            {
                e.Handled = true;

                var email = MessageBox.Show(
                    Properties.Resources.UnhandledExPrompt,
                    Properties.Resources.UnhandledExTitle,
                    MessageBoxButton.OKCancel) == MessageBoxResult.OK;

                if (email)
                {
                    ErrorReport.Report(ex);
                    return;
                }

                throw new QuitException();
            }

            Debugger.Break();
        }
Example #2
0
 private void OnAppUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (AppUnhandledException != null)
     {
         AppUnhandledException(e);
     }
 }
Example #3
0
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (!Debugger.IsAttached) {
         e.Handled = true;
         Deployment.Current.Dispatcher.BeginInvoke(() => this.ReportErrorToDOM(e));
     }
 }
Example #4
0
        private static void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            try
            {
                string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
                errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");

                Tracer.Error(errorMsg);
                e.Handled = true;

                var control = new ExceptionControl();
                var viewModel = new ExceptionViewModel();

                viewModel.Exception = GenerateCrashReport(e.ExceptionObject);
                control.DataContext = viewModel;

                _gameHost.LayoutRoot.Children.Clear();
                _gameHost.LayoutRoot.Children.Add(control);
            }
            catch
            {
                try
                {
                    MessageBox.Show(e.ExceptionObject.ToString());
                }
                catch
                {
                    ReportErrorToDOM(e.ExceptionObject);
                }
            }
        }
 // Code to execute on Unhandled Exceptions
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (System.Diagnostics.Debugger.IsAttached) {
         // An unhandled exception has occurred; break into the debugger
         System.Diagnostics.Debugger.Break();
     }
 }
Example #6
0
        private static void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (System.Diagnostics.Debugger.IsAttached) return;

            e.Handled = true;
            Deployment.Current.Dispatcher.BeginInvoke(() => ReportErrorToDOM(e));
        }
Example #7
0
        private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
        {
            try
               {
              //string errorMsg;
              //errorMsg = e.ExceptionObject.GetType().ToString();
              //errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
              //System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('" + errorMsg + "');");
              //
              //errorMsg = e.ExceptionObject.Message;
              //errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
              //System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('" + errorMsg + "');");
              //
              //
              //errorMsg = e.ExceptionObject.StackTrace ;
              //errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
              //System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('" + errorMsg + "');");

              ////System.Windows.Browser.HtmlPage.Window.Eval("ttrace.debug().send('" + errorMsg + "');");

              System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('ReportErrorToDOM error');");
               }
               catch (Exception)
               {
              System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('ReportErrorToDOM error');");
               }
        }
Example #8
0
        /// <summary>未処理例外発生イベントハンドラ</summary>
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            // アプリケーションがデバッガーの外側で実行されている場合、ブラウザーの
            // 例外メカニズムによって例外が報告されます。これにより、IE ではステータス バーに
            // 黄色の通知アイコンが表示され、Firefox にはスクリプト エラーが表示されます。
            if (!System.Diagnostics.Debugger.IsAttached)
            {
                // メモ : これにより、アプリケーションは例外がスロー
                // された後も実行され続け、例外はハンドルされません。 
                // 実稼動アプリケーションでは、このエラー処理は、Web サイトにエラーを
                // 報告し、アプリケーションを停止させるものに置換される必要があります。
                e.Handled = true;

                // JavaScriptで例外レポートを報告
                Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
            }

            // MessageBoxで例外情報表示
            MessageBox.Show(e.ExceptionObject.Message);

            // MessageBoxで内部例外情報表示
            if (e.ExceptionObject.InnerException != null)
            {
                MessageBox.Show(e.ExceptionObject.InnerException.Message);
            }
        }
Example #9
0
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            //MessageBox.Show(e.ExceptionObject.Message);
            try
            {
                if (RootVisual == null)
                {
                    string msg = e.ExceptionObject.Message;
                    if (e.ExceptionObject is CustomException)
                    {
                        CustomException csEx = (CustomException)e.ExceptionObject;
                        msg = csEx.ExceptionMessage;
                    }
                    System.Windows.MessageBox.Show(msg);
                    return;
                }
                else if (RootVisual.CheckAccess())  //是否能线程访问
                {
                    HandleAppException(e);
                }
                else
                {
                    RootVisual.Dispatcher.BeginInvoke(() =>
                    {
                        HandleAppException(e);
                    });
                }
            }
            catch (Exception)
            {

            }
            e.Handled = true;
            return;
        }
Example #10
0
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (!System.Diagnostics.Debugger.IsAttached)
     {
     }
     e.Handled = true;
 }
Example #11
0
		private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
		{
			// Allow the application to continue running after an exception has been thrown but not handled
			Exception ex = e.ExceptionObject;
			ex.Alert();
			e.Handled = true;
		}
Example #12
0
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            try
            {
                ILog logger = new Logger(new Framework.SL.Repositories.LogEntryWebserviceRepository());
                ErrorLogEntry error = new ErrorLogEntry()
                {
                    Message = e.ExceptionObject.ToString(),
                    Source = "UNHANDLED IN: " + sender.GetType().ToString(),
                    TimeStamp = DateTime.Now
                };

                logger.WriteEntry(error);
                e.Handled = true;
            }
            catch (Exception logException)
            {
                // If the app is running outside of the debugger then report the exception using
                // the browser's exception mechanism. On IE this will display it a yellow alert 
                // icon in the status bar and Firefox will display a script error.
                if (!System.Diagnostics.Debugger.IsAttached)
                {
                    // NOTE: This will allow the application to continue running after an exception has been thrown
                    // but not handled. 
                    // For production applications this error handling should be replaced with something that will 
                    // report the error to the website and stop the application.
                    e.Handled = true;
                    //MessageBox.Show(e.ExceptionObject.Message);
                    //Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
                }
            }
        }
Example #13
0
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
		{
			if (System.Diagnostics.Debugger.IsAttached) return;

			e.Handled = true;
			ErrorPresenter.Show(e.ExceptionObject);
		}
Example #14
0
 void App_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (e.ExceptionObject.GetType() == typeof (NoInternetConnectionException))
         MessageBox.Show("Could not find an Internet connection - please try again later");
     else
         MessageBox.Show("An error occured - the application will now close");
 }
Example #15
0
 private void App_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (Debugger.IsAttached)
     {
         Debugger.Break();
     }
 }
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            // If the app is running outside of the debugger then report the exception using
            // the browser's exception mechanism. On IE this will display it a yellow alert
            // icon in the status bar and Firefox will display a script error.
            if (!System.Diagnostics.Debugger.IsAttached)
            {

                // NOTE: This will allow the application to continue running after an exception has been thrown
                // but not handled.
                // For production applications this error handling should be replaced with something that will
                // report the error to the website and stop the application.
                e.Handled = true;

                try
                {
                    string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
                    errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");

                    System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight 2 Application " + errorMsg + "\");");
                }
                catch (Exception)
                {
                }
            }
        }
Example #17
0
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
     //errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
     e.Handled = false;
     MessageBox.Show(errorMsg);
 }
Example #18
0
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (System.Diagnostics.Debugger.IsAttached)
     {
         System.Diagnostics.Debugger.Break();
     }
 }
 protected override void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     MessageBox.Show("Unexpected problem occured. Application will be closed." +
                     (System.Diagnostics.Debugger.IsAttached ? '\n' + e.ExceptionObject.Message : ""),
                     "Unexpected problem", MessageBoxButton.OK);
     base.OnUnhandledException(sender, e);
 }
Example #20
0
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (e.ExceptionObject is DomainOperationException)
            {
                if (((DomainOperationException)e.ExceptionObject).Status == OperationErrorStatus.Unauthorized)
                {
                    System.Windows.MessageBox.Show("Your session has expired please login.", "Session expired", MessageBoxButton.OK);
                    WebContextBase.Current.Authentication.Logout(null, null);
                    e.Handled = true;
                    return;
                }
            }

            // If the app is running outside of the debugger then report the exception using
            // the browser's exception mechanism. On IE this will display it a yellow alert
            // icon in the status bar and Firefox will display a script error.
            if (!System.Diagnostics.Debugger.IsAttached)
            {

                // NOTE: This will allow the application to continue running after an exception has been thrown
                // but not handled.
                // For production applications this error handling should be replaced with something that will
                // report the error to the website and stop the application.
                e.Handled = true;
                Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
            }
        }
Example #21
0
        private static void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
        {
            var errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
            errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");

            System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
        }
 /// Code to execute on Unhandled Exceptions
 static void UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (Debugger.IsAttached)
     {
         // An unhandled exception has occurred; break into the debugger
         Debugger.Break();
     }
 }
Example #23
0
 /// 出现未处理的异常时执行的代码
 private void ScheduledAgent_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if ( System. Diagnostics. Debugger. IsAttached )
     {
         // 出现未处理的异常;强行进入调试器
         System. Diagnostics. Debugger. Break( );
     }
 }
Example #24
0
		private void Application_UnhandledException( object sender, ApplicationUnhandledExceptionEventArgs e )
		{
			if ( Debugger.IsAttached )
			{
				Debug.WriteLine( e.ExceptionObject );
				Debugger.Break();
			}
		}
Example #25
0
 private void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs args)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append(CreateHeader());
     builder.AppendLine();
     builder.Append(CreateStackTrace(args));
     SaveLog(builder.ToString());
 }
Example #26
0
 private static void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (!Debugger.IsAttached)
     {
         e.Handled = true;
         Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDom(e); });
     }
 }
Example #27
0
        void GlobalUnhandledExceptionHandler(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (Debugger.IsAttached)
                Debugger.Break();

            e.Handled = true;
            NotifyComplete();
        }
 // Code, der bei nicht behandelten Ausnahmen ausgeführt wird
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (System.Diagnostics.Debugger.IsAttached)
     {
         // Eine nicht behandelte Ausnahme ist aufgetreten. Unterbrechen und Debugger öffnen
         System.Diagnostics.Debugger.Break();
     }
 }
Example #29
0
 /// 發生未處理的例外狀況時要執行的程式碼
 private void ScheduledAgent_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (System.Diagnostics.Debugger.IsAttached)
     {
         // 發生未處理的例外狀況; 切換到偵錯工具
         System.Diagnostics.Debugger.Break();
     }
 }
Example #30
0
    void Current_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) {
//#if !DEBUG
      if (!e.Handled) {
        e.Handled = true;
        msgBx.ShowError(EBioException.CreateIfNotEBio(e.ExceptionObject), "Непредвиденная ошибка!", null);
      }
//#endif
    }