static void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { // * Occurance of this exception in most cases is caused by sudden network disconnection // between service and client (caused by other softwares or network restart). // * When this occures, client will be presented the Init page with an exact error message, // where he can retry the connection. // * So we cannot call this a crash, since there is a recovery route for the initial error if (e.Exception is IVPNClientProxyNotConnectedException || e.Exception is OperationCanceledException) { e.Handled = true; return; } // Prevent multiple exceptions if (__ExceptionCought) { return; } __ExceptionCought = true; ExceptionWindow wnd = new ExceptionWindow(e.Exception, false); wnd.ShowDialog(); e.Handled = true; // Force the application to exit after // show crash is show to the user System.Environment.Exit(120); }
private void ProcessServiceCrashLogIfExisists() { // Check is there was an Service crash if (File.Exists(Platform.ServiceCrashInfoFilePath)) { try { string serviceCrashInfo = FileUtils.TailOfLog(Platform.ServiceCrashInfoFilePath); // send requeest to remove crash-info file Service.RemoveServiceCrashFile(); if (string.IsNullOrEmpty(serviceCrashInfo) == false) { Dispatcher.Invoke(() => { ExceptionWindow wnd = new ExceptionWindow(new IVPNServiceCrash(serviceCrashInfo), true, StringUtils.String("Crash_ServiceCrashedText")); wnd.Show(); }); } } catch (Exception ex) { Logging.Info($"Exception during processing Agent crash-log: {ex}"); } } }