private void HandleException(object sender, UnhandledExceptionEventArgs e) { var ex = (Exception)e.ExceptionObject; LogException(ex); if (MyFakes.ENABLE_MINIDUMP_SENDING) { string path = Path.Combine(MyFileSystem.UserDataPath, "Minidump.dmp"); Log.Info($"Generating minidump at {path}"); MyMiniDump.Options options = MyMiniDump.Options.WithProcessThreadData | MyMiniDump.Options.WithThreadInfo; MyMiniDump.Write(path, options, MyMiniDump.ExceptionInfo.Present); } LogManager.Flush(); if (_config.RestartOnCrash) { Console.WriteLine("Restarting in 5 seconds."); Thread.Sleep(5000); var exe = typeof(Program).Assembly.Location; _config.WaitForPID = Process.GetCurrentProcess().Id.ToString(); Process.Start(exe, _config.ToString()); } else { MessageBox.Show("Torch encountered a fatal error and needs to close. Please check the logs for details."); } Process.GetCurrentProcess().Kill(); }
public bool WriteMiniDump(string dumpPath, MyMiniDump.Options dumpFlags, MyMiniDump.ExceptionInfo info) { return(false); }