public static void BuildFromException(object sender, UnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { return; } if ( MessageBox.Show("Chummer5a crashed.\nDo you want to send a crash report to the developer?", "Crash!", MessageBoxButtons.YesNo) == DialogResult.Yes) { CrashReport report = new CrashReport(Guid.NewGuid()) .AddDefaultData() .AddData("exception.txt", e.ExceptionObject.ToString()); Log.Kill(); //Make sure log object is not used try { string strFile = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "chummerlog.txt"; report.AddData("chummerlog.txt", new StreamReader(strFile).BaseStream); } catch (Exception ex) { report.AddData("chummerlog.txt", ex.ToString()); } //Considering doing some magic with //Application.OpenForms //And reflection to all savefiles //here //try to include default settings file try { string strFilePath = Path.Combine(Environment.CurrentDirectory, "settings"); strFilePath = Path.Combine(strFilePath, "default.xml"); report.AddData("default.xml", new StreamReader(strFilePath).BaseStream); } catch (Exception ex) { report.AddData("default.xml", ex.ToString()); } report.Send(); MessageBox.Show("Crash report sent.\nPlease refer to the crash id " + report.Id); } }
public static void BuildFromException(object sender, UnhandledExceptionEventArgs e) { if (Debugger.IsAttached) return; if ( MessageBox.Show("Chummer5a crashed.\nDo you want to send a crash report to the developer?", "Crash!", MessageBoxButtons.YesNo) == DialogResult.Yes) { CrashReport report = new CrashReport(Guid.NewGuid()) .AddDefaultData() .AddData("exception.txt", e.ExceptionObject.ToString()); Log.Kill(); //Make sure log object is not used try { string strFile = Path.Combine(Environment.CurrentDirectory, "chummerlog.txt"); report.AddData("chummerlog.txt", new StreamReader(strFile).BaseStream); } catch(Exception ex) { report.AddData("chummerlog.txt", ex.ToString()); } //Considering doing some magic with //Application.OpenForms //And reflection to all savefiles //here //try to include default settings file try { string strFilePath = Path.Combine(Environment.CurrentDirectory, "settings", "default.xml"); report.AddData("default.xml", new StreamReader(strFilePath).BaseStream); } catch (Exception ex) { report.AddData("default.xml", ex.ToString()); } report.Send(); MessageBox.Show("Crash report sent.\nPlease refer to the crash id " + report.Id); } }
public static void BuildFromException(object sender, UnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { return; } CrashReport report = new CrashReport(Guid.NewGuid()) .AddDefaultData() .AddData("exception.txt", e.ExceptionObject.ToString()); Log.Kill(); //Make sure log object is not used try { string strFile = Path.Combine(Application.StartupPath, "chummerlog.txt"); report.AddData("chummerlog.txt", new StreamReader(strFile).BaseStream); } catch (Exception ex) { report.AddData("chummerlog.txt", ex.ToString()); } //Considering doing some magic with //Application.OpenForms //And reflection to all savefiles //here //try to include default settings file try { string strFilePath = Path.Combine(Application.StartupPath, "settings", "default.xml"); report.AddData("default.xml", new StreamReader(strFilePath).BaseStream); } catch (Exception ex) { report.AddData("default.xml", ex.ToString()); } report.Send(); MessageBox.Show("Crash report sent.\nPlease refer to the crash id " + report.Id); }