private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { // 如果应用程序是在调试器外运行的,则使用浏览器的 // 异常机制报告该异常。在 IE 上,将在状态栏中用一个 // 黄色警报图标来显示该异常,而 Firefox 则会显示一个脚本错误。 if (!System.Diagnostics.Debugger.IsAttached) { // 注意: 这使应用程序可以在已引发异常但尚未处理该异常的情况下 // 继续运行。 // 对于生产应用程序,此错误处理应替换为向网站报告错误 // 并停止应用程序。 e.Handled = true; Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); } }
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; Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); } }
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { // If the app is running outside of the debugger then report the exception using // a ChildWindow control. 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; ChildWindow errorWin = new ErrorWindow(e.ExceptionObject); errorWin.Show(); } }
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { // Si la aplicación se está ejecutando fuera del depurador, informe de la excepción mediante // el mecanismo de excepciones del explorador. En IE se mostrará un icono de alerta amarillo // en la barra de estado y en Firefox se mostrará un error de script. if (!System.Diagnostics.Debugger.IsAttached) { // NOTA: esto permitirá a la aplicación continuar ejecutándose después de que una excepción se haya producido // pero no controlado. // Para las aplicaciones de producción, este control de errores se debe reemplazar por algo que // informará del error al sitio web y detendrá la aplicación. e.Handled = true; Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); } }
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) { 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 Application " + errorMsg + "\");"); //ChildWindow errorWin = new ErrorWindow("Unhandled Error in Silverlight Application", errorMsg); //errorWin.Show(); Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), errorMsg); } catch (Exception) { } }
// 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(); } exdsfg = e.ExceptionObject; RootFrame.Navigate(new Uri("/Views/ErrorPage.xaml", UriKind.Relative)); e.Handled = true; }
// Code to execute on Unhandled Exceptions private void ApplicationUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger Debugger.Break(); } //App.ShowMessage("Nuts, something broke. Could you let the developer know please."); _logger.FatalException("UnhandledException", e.ExceptionObject); e.Handled = true; SaveSettings(); }
// Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (e.ExceptionObject is QuitException) { return; } App.SaveException(e.ExceptionObject.ToString() + "\r\n\r\n" + XMPPLogBuilder.ToString()); if (System.Diagnostics.Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger System.Diagnostics.Debugger.Break(); } }
/// <summary> /// Handler for application unhandled exception /// </summary> /// <param name="sender">Object</param> /// <param name="e">ApplicationUnhandledExceptionEventArgs</param> private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (_logLevel == 1) { if (Logger == null) { AddLogViewer(_wrapper); } if (e.ExceptionObject != null && e.ExceptionObject.InnerException != null) { Logger.LogLine("InnerException: " + e.ExceptionObject.InnerException.Message + "\n"); } Logger.LogLine("Exception: " + e.ExceptionObject.Message + "\n"); // _skipHighlightValue = Logger.Text.Length; Logger.LogLine("XML:\n" + _dataXml + "\n"); Logger.LogLine("In case you are an Enterprise Customer, please create a ticket for priority support directly from Visifire Developers.\n Otherwise, please copy-paste the contents of this log in forum and our community members will help you.\n"); Logger.Log(" Ticket: http://visifire.com/support\n"); Logger.Log(" Forum: http://visifire.com/forums\n"); Logger.LogLine("StackTrace: \n" + e.ExceptionObject.StackTrace + "\n"); Logger.Visibility = Visibility.Visible; Logger.SetValue(Canvas.ZIndexProperty, 10000); foreach (FrameworkElement child in _wrapper.LayoutRoot.Children) { if (child != Logger) { child.Visibility = Visibility.Collapsed; } } //CalculateSkipHighlightingText(Logger.Text); Logger.SkipHighlight = _skipHighlightValue; Logger.HeighlightText = _string2Highlight; Logger.HelpLink = "http://visifire.com/visifire_charts_documentation.php"; e.Handled = true; // Logger.Highlight(_string2Highlight); } }
private void OnUnhandledError(Exception ex) { if (ShouldLogUnhandledErrors) { ErrorLog.WriteError("An unhandled error occurred", ex); } ApplicationUnhandledExceptionEventArgs e = new ApplicationUnhandledExceptionEventArgs(ex, false); if (UnhandledError != null) { UnhandledError(this, e); } if (!e.Handled && System.Diagnostics.Debugger.IsAttached) { throw ex; } }
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { string errorMessage = String.Empty; if (e.ExceptionObject.InnerException != null && e.ExceptionObject.InnerException is System.ServiceModel.FaultException) { //wcf exception. FaultException exc = e.ExceptionObject.InnerException as FaultException; errorMessage = exc.Reason.ToString(); ExMessageBox.Show(errorMessage); // WCFエラーの場合はアプリケーションを終了する if (Application.Current.IsRunningOutOfBrowser) { Application.Current.MainWindow.Close(); } } else { //silverlight exception. errorMessage = e.ExceptionObject.Message; ExMessageBox.Show(errorMessage); // 処理を続行する e.Handled = true; Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); //redirect to error page. } //handle exception so app doesn't crash. // アプリケーションがデバッガーの外側で実行されている場合、ブラウザーの // 例外メカニズムによって例外が報告されます。これにより、IE ではステータス バーに // 黄色の通知アイコンが表示され、Firefox にはスクリプト エラーが表示されます。 //if (!System.Diagnostics.Debugger.IsAttached) //{ // // メモ : これにより、アプリケーションは例外がスローされた後も実行され続け、例外は // // ハンドルされません。 // // 実稼動アプリケーションでは、このエラー処理は、Web サイトにエラーを報告し、 // // アプリケーションを停止させるものに置換される必要があります。 // e.Handled = true; // Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); //} }
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (!System.Diagnostics.Debugger.IsAttached) { e.Handled = true; try { string errorMsg = e.ExceptionObject.Message + @"\n" + 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) { } } }
// Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { // NokiaMusicException's give an error message... if (e.ExceptionObject as MixRadioException != null) { MessageBox.Show(e.ExceptionObject.Message); e.Handled = true; return; } if (System.Diagnostics.Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger System.Diagnostics.Debugger.Break(); } MessageBox.Show("oops, something went wrong...\r\n" + e.ExceptionObject.Message); }
private String CreateStackTrace(ApplicationUnhandledExceptionEventArgs args) { Exception exception = args.ExceptionObject; StringBuilder builder = new StringBuilder(); builder.AppendLine(string.IsNullOrEmpty(exception.Message) ? "No reason" : exception.Message); builder.Append(string.IsNullOrEmpty(exception.StackTrace) ? " at unknown location" : exception.StackTrace); Exception inner = exception.InnerException; if ((inner != null) && (!string.IsNullOrEmpty(inner.StackTrace))) { builder.AppendLine(); builder.AppendLine("Inner Exception"); builder.Append(inner.StackTrace); } return(builder.ToString().Trim()); }
private async void App_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { try { LimitedCrashExtraDataList extrasExtraDataList = new LimitedCrashExtraDataList { new CrashExtraData("The Hindu", e.ExceptionObject.Message), new CrashExtraData("The Hindu", e.ExceptionObject.StackTrace), }; BugSenseResponseResult sendResult = await BugSenseHandler.Instance.SendExceptionAsync(e.ExceptionObject, extrasExtraDataList); } catch (Exception exception) { if (Debugger.IsAttached) { Debug.WriteLine("App.xaml.cs:" + exception); } } }
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (e.Handled || ESRI.ArcGIS.Mapping.Core.AsyncExtensions.DownloadStringTaskInProgress) { return; } Logger.Instance.LogError(e.ExceptionObject); if (e.ExceptionObject != null && e.ExceptionObject.StackTrace != null && e.ExceptionObject.StackTrace.Contains("ESRI.ArcGIS.Client.WebMap.MapConfiguration")) { // if loading a webmap caused the problem kill the loading indicator if (BuilderApplication.Instance.MapCenter != null && BuilderApplication.Instance.MapCenter.LoadingMapIndicator != null) { BuilderApplication.Instance.MapCenter.LoadingMapIndicator.Visibility = Visibility.Collapsed; } } e.Handled = true; ReportErrorToUser(e, LayerErrorHandler.HandleIfLayerError(e.ExceptionObject)); }
// Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (e.ExceptionObject.Message != "ExitAppException") { if (Debugger.IsAttached) { Debugger.Break(); } else if (MessageBox.Show("App has ran into an unknown problem, do you want to report it?\nClick OK to report and exit, Cancel to exit without reporting", "Error detected", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { EmailComposeTask task = new EmailComposeTask(); task.To = "*****@*****.**"; task.Subject = "Bug Report"; task.Body = "Your message: \n\n" + e.ExceptionObject.ToString(); task.Show(); Thread.Sleep(2000); MessageBox.Show("Press OK to exit."); } } }
private static void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (e.ExceptionObject is AssertFailedException) { return; } ClientLogger.Debug("Error: Unhandled exception: " + e.ExceptionObject); e.Handled = true; // 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(() => ReportErrorToDOM(e)); //} }
// 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(); } // trace the exception if (e.ExceptionObject != null) { TraceHelper.AddMessage("Exception: " + e.ExceptionObject.Message); TraceHelper.AddMessage("StackTrace: " + e.ExceptionObject.StackTrace); } else { TraceHelper.AddMessage("Exception: null"); } // store the crash report before exiting TraceHelper.StoreCrashReport(); }
// Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger Debugger.Break(); } // TODO: log, mail and add our own exception reporter XLog.WriteDebug(e.ToString()); }
// Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger Debugger.Break(); } }