static void UncaughtExceptionHandler(object sender, System.Threading.ThreadExceptionEventArgs args) { // don't allow any further exceptions out try { // first of all, make sure the edited script is not lost System.IO.File.WriteAllText(Program.BasePath + "/emergencyBackup.nut", GeoGen.Studio.Main.Get().editorBackup); // also write the exception to disk System.IO.File.WriteAllText(Program.BasePath + "/exceptionInfo.txt", args.Exception.ToString()); // hide the loading dialog (if it is displayed) try { GeoGen.Studio.Main.Get().loading.Hide(); } catch { } Crash dialog = new Crash(); dialog.errorInfo.Text = args.Exception.ToString(); dialog.ShowDialog(); } catch { } finally{ /* Kill the process the the program doesn't freeze after user clicks OK in the exception dialog * (the exception handled by the AppDomain.CurrentDomain.UnhandledException handler doesn't appear * as caught). */ System.Diagnostics.Process.GetCurrentProcess().Kill(); } }
static void UncaughtExceptionHandler(object sender, System.Threading.ThreadExceptionEventArgs args){ // don't allow any further exceptions out try { // first of all, make sure the edited script is not lost System.IO.File.WriteAllText(Program.BasePath + "/emergencyBackup.nut", GeoGen.Studio.Main.Get().editorBackup); // also write the exception to disk System.IO.File.WriteAllText(Program.BasePath + "/exceptionInfo.txt", args.Exception.ToString()); // hide the loading dialog (if it is displayed) try { GeoGen.Studio.Main.Get().loading.Hide(); } catch { } Crash dialog = new Crash(); dialog.errorInfo.Text = args.Exception.ToString(); dialog.ShowDialog(); } catch { } finally{ /* Kill the process the the program doesn't freeze after user clicks OK in the exception dialog * (the exception handled by the AppDomain.CurrentDomain.UnhandledException handler doesn't appear * as caught). */ System.Diagnostics.Process.GetCurrentProcess().Kill(); } }