private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (!System.Diagnostics.Debugger.IsAttached) { Closing(); Message.Show("UnhandledException", e.ExceptionObject.Message); e.Handled = true; Deployment.Current.Dispatcher.BeginInvoke(delegate {ReportErrorToDOM(e);}); } }