Inheritance: IUnhandledExceptionEventArgs
Beispiel #1
0
        private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            // Do not crash.
            e.Handled = true;

            // Global error handler.
            var rootFrame = Window.Current.Content as Frame;
            if (rootFrame != null)
                rootFrame.Navigate(typeof(MainPage), e.Exception);
        }
Beispiel #2
0
        private async void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
        {
            e.Handled = true;
            try
            {
                var dialog = new MessageDialog("Ooops! We didn't anticipate this: " + e.Exception.Message);
                dialog.Commands.Add(new UICommand {
                    Label = "Ok", Id = 0
                });

                var result = await dialog.ShowAsync();
            }
            catch
            {
                var dialog = new MessageDialog("An unhandled error occurred.");
                dialog.Commands.Add(new UICommand {
                    Label = "Ok", Id = 0
                });

                var result = await dialog.ShowAsync();
            }
        }
Beispiel #3
0
 private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     Common.Invoke((async() =>
     {
         ContentDialog Dialog = new ContentDialog
         {
             Title = "遇到了错误",
             Content = e.Exception.ToString(),
             CloseButtonText = "忽略",
             PrimaryButtonText = "退出"
         };
         ContentDialogResult result = await Dialog.ShowAsync();
         if (result == ContentDialogResult.Primary)
         {
             Environment.Exit(-1);
         }
         else
         {
             e.Handled = true;
         }
     }));
 }
Beispiel #4
0
        private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
        {
            DebugLogger.Log("Unhandled fatal application exception: " + e.Exception.ToString());
            var localSettings = ApplicationData.Current.LocalSettings.Values;
            var exStr         = e.Exception.ToString() + "\r\n" + e.Message + "\r\n" + e.Exception.StackTrace;

            if (localSettings.TryGetValue("lastError", out var lastErr) && lastErr is string lastErrStr)
            {
                lastErrStr += "\r\n" + exStr;
            }
            else
            {
                lastErrStr = exStr;
            }
            localSettings["lastError"] = lastErrStr;
            if (e.Exception.InnerException != null)
            {
                DebugLogger.Log("Unhandled fatal application inner exception: " + e.Exception.InnerException.ToString());
            }
#if !DEBUG
            e.Handled = true;
#endif
        }
Beispiel #5
0
        private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
        {
            e.Handled = true;
            if (e.Exception is NullReferenceException n)
            {
                // ignore a weird exception from data binding
                if (n.StackTrace?.Contains("Aurora.Music.Controls.ListItems") ?? false)
                {
                    return;
                }
            }
            Core.Tools.Helper.Logging(e);

            if (MainPage.Current is MainPage p
#if !DEBUG
                && (e.Exception is NotImplementedException || e.Exception is UnauthorizedAccessException)
#endif
                )
            {
                p.ThrowException(e);
            }

            try
            {
                if (Window.Current?.Content is Frame f)
                {
                    if (f.Content is WelcomePage)
                    {
                        Settings.Current.WelcomeFinished = true;
                        Settings.Current.Save();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #6
0
        private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
        {
            if (UnhandledExceptionTimes <= 10)
            {
                parameters.ErrorMessage = e.Exception.Message;
                parameters.StackTrace   = e.Exception.StackTrace;
                parameters.AutoNavigate = true;
            }
            else
            {
                parameters.ErrorMessage = e.Exception.Message;
                parameters.StackTrace   = e.Exception.StackTrace;
                parameters.AutoNavigate = false;
            }

            //Just in case exception is not reported during testing.
            Analytics.TrackEvent("Exception occurred");

            Frame rootFrame = Window.Current.Content as Frame;

            rootFrame.Navigate(typeof(UnhandledExceptionPage), parameters);
            UnhandledExceptionTimes++;
            e.Handled = true;
        }
Beispiel #7
0
 private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     LogManager.GetLog(typeof(UwCoreApp)).Error(e.Exception);
 }
Beispiel #8
0
 // Occurs when an exception is not handled on the UI thread.
 private static void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) => AppUnhandledException(e.Exception);
Beispiel #9
0
 private void CurrentOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     Logger.Fatal("CurrentOnUnhandledException", e.Exception);
     LogManager.Default.Flush();
 }
Beispiel #10
0
        private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
        {
            var logger = App.ServiceProvider.GetService(typeof(ILogger <App>)) as ILogger <App>;

            logger.LogError(e.Exception, "Unhandled");
        }
Beispiel #11
0
 private async void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     e.Handled = true;
     await new MessageDialog(e.Exception.StackTrace, e.Exception.Message).ShowAsync();
 }
Beispiel #12
0
 private void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     this.bugsnagClient.Notify(e.Exception, Severity.Error);
 }
Beispiel #13
0
        private async void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            e.Handled = true;

            await ShowErrorDialog(e.Exception);
        }
Beispiel #14
0
 private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     ExceptionTracer.RequestBlueScreen(e.Exception);
     e.Handled = true;
 }
Beispiel #15
0
 private async void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     e.Handled = true;
     await new MessageDialog("Application Unhandled Exception:\r\n" + GetExceptionDetailMessage(e.Exception), "爆了 :(")
     .ShowAsync();
 }
Beispiel #16
0
 private void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     Debug.WriteLine(e.Message);
     Debugger.Break();
     e.Handled = true;
 }
Beispiel #17
0
 private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     LogManager.GetCurrentClassLogger().Fatal(e.Exception);
 }
Beispiel #18
0
 private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     Services.LogService.ErrorWrite(e.Exception, sender.ToString());
 }
 private void OnCurrentApplicationUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     e.Handled = this.HandleException(e.Exception);
 }
 /// <summary>
 /// Gets called if an exception was thrown that was not handled by user-code.
 /// </summary>
 /// <param name="eventArguments">The event arguments that contain further information about the exception that was not properly handled by user-code.</param>
 protected virtual Task OnUnhandledExceptionAsync(UnhandledExceptionEventArgs eventArguments) => Task.FromResult(0);
Beispiel #21
0
 private async void OnAppUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     e.Handled = true;
     await new MessageDialog("OnAppUnhandledException:" + Environment.NewLine + e.Exception.Message).ShowAsync();
 }
Beispiel #22
0
        private async void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            // say we've handled this one. this allows our FATAL write to complete.
            e.Handled = true;

            var ex = ExceptionUtils.UnwrapException(e.Exception);

            await ((ILoggerAsync)log).FatalAsync("CRASH!", ex);

            // if we're aborting, fake a suspend to flush the targets...
            await LazyFlushManager.FlushAllAsync(new LogWriteContext());

            ApplicationData.Current.LocalSettings.Values[LocalSettingsKeys.LogsUploadPending] = true;

            // abort the app here...
            Current.Exit();
        }
 private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     e.Handled = true;
     var errMsg = XamarinHelpers.ShowOkMessage("Error", $"An unexpected error occurred: \n{e.Exception}");
 }
Beispiel #24
0
 private async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     await Utils.MessageBox(e.Message);
     e.Handled = true;
 }
Beispiel #25
0
 private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     e.Handled = HandleExceptions.IsOn;
 }
Beispiel #26
0
 protected override void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
 }
Beispiel #27
0
 private void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     e.Handled = true;
     OtherHelper.ShowContentDialog(e.Exception.ToString());
 }
 private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     RollbarLocator.RollbarInstance.AsBlockingLogger(RollbarHelper.RollbarTimeout).Critical(e.Exception);
 }
Beispiel #29
0
 private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     Logger.Error("Unhanded exception: ", e.Exception);
 }
Beispiel #30
0
 private async void OnAppUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     e.Handled = true;
     await new MessageDialog("OnAppUnhandledException:" + Environment.NewLine + e.Exception.Message).ShowAsync();
 }
Beispiel #31
0
 private void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     Logger.Instance.Error(e.Exception, "Unhandled Exception");
 }
Beispiel #32
0
 private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     // define DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
     // to turn off the default debugger break
     Logging.WriteLogMessage(e?.Exception?.ToString() ?? "Invalid exception in backstop handler");
 }
Beispiel #33
0
 private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) => LogException(e.Exception);
Beispiel #34
0
 private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     Logger.LogError(e.Exception);
     Logger.Log(e.Message);
     e.Handled = true;
 }
Beispiel #35
0
 private void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     // should log here, but we're not logging in this app
 }
Beispiel #36
0
 private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     IEventAggregator eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
     eventAggregator.GetEvent<Events.DebugEvent>().Publish(new DebugEventArgs(e.Exception));
     e.Handled = true;
 }
Beispiel #37
0
 private void OnAppUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     // TODO WTS: Please log and handle the exception as appropriate to your scenario
     // For more info see https://docs.microsoft.com/uwp/api/windows.ui.xaml.application.unhandledexception
 }
Beispiel #38
0
        private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
        {
#if DEBUG
            e.Handled = true;
#endif
        }
Beispiel #39
0
 private void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(e.Exception.ToString());
 }
 private void WindowsRTApplication_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     Debug.WriteLine(e.Message);
 }