private async void SynchronizationContextUnhandledException(object sender, AysncUnhandledExceptionEventArgs e) { e.Handled = true; var ex = e.Exception; var message = ex.Message; if (message.Contains("A task was canceled")) //TODO { } else { await DispatcherHelper.RunAsync(async () => { await new MessageDialog("Error:\r\n" + message).ShowAsync(); }); } }
private bool HandleException(Exception exception) { if (UnhandledException == null) { return false; } var exWrapper = new AysncUnhandledExceptionEventArgs {Exception = exception}; UnhandledException(this, exWrapper); #if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION if (Debugger.IsAttached) { Debugger.Break(); } #endif return exWrapper.Handled; }