コード例 #1
0
ファイル: CrashHandler.cs プロジェクト: Stexinator/chummer5a
        public static void WebMiniDumpHandler(Exception ex)
        {
            try
            {
                DumpData dump = new DumpData(ex);
                foreach (string strSettingFile in Directory.EnumerateFiles(Utils.GetSettingsFolderPath, "*.xml"))
                {
                    dump.AddFile(strSettingFile);
                }

                dump.AddFile(Path.Combine(Utils.GetStartupPath, "chummerlog.txt"));

                byte[] info = new UTF8Encoding(true).GetBytes(dump.SerializeBase64());
                File.WriteAllBytes(Path.Combine(Utils.GetStartupPath, "json.txt"), info);

#if DEBUG
                using (Process crashHandler
                           = Process.Start("crashhandler", "crash " + Path.Combine(Utils.GetStartupPath, "json.txt")
                                           + " --debug"))
#else
                using (Process crashHandler
                           = Process.Start("crashhandler", "crash " + Path.Combine(Utils.GetStartupPath, "json.txt")))
#endif
                    crashHandler?.WaitForExit();
            }
            catch (Exception nex)
            {
                Program.ShowMessageBox(
                    "Failed to create crash report." + Environment.NewLine +
                    "Chummer crashed with version: " + Utils.CurrentChummerVersion + Environment.NewLine +
                    "Here is some information to help the developers figure out why:" + Environment.NewLine + nex +
                    Environment.NewLine + "Crash information:" + Environment.NewLine + ex, "Failed to Create Crash Report", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: CrashHandler.cs プロジェクト: smcnabb83/chummer5a
        public static void WebMiniDumpHandler(Exception ex)
        {
            try
            {
                DumpData dump = new DumpData(ex);
                dump.AddFile(Path.Combine(Utils.GetStartupPath, "settings", "default.xml"));
                dump.AddFile(Path.Combine(Utils.GetStartupPath, "chummerlog.txt"));

                byte[] info = new UTF8Encoding(true).GetBytes(dump.SerializeBase64());
                File.WriteAllBytes(Path.Combine(Utils.GetStartupPath, "json.txt"), info);

                if (GlobalOptions.UseLoggingApplicationInsights)
                {
                    if (Program.TelemetryClient != null)
                    {
                        ExceptionTelemetry et = new ExceptionTelemetry(ex)
                        {
                            SeverityLevel = SeverityLevel.Critical
                        };
                        Program.TelemetryClient.TrackException(et);
                        Program.TelemetryClient.Flush();
                    }
                }

                //Process crashHandler = Process.Start("crashhandler", "crash " + Path.Combine(Utils.GetStartupPath, "json.txt") + " --debug");
                Process crashHandler = Process.Start("crashhandler", "crash " + Path.Combine(Utils.GetStartupPath, "json.txt"));

                crashHandler?.WaitForExit();
            }
            catch(Exception nex)
            {
                MessageBox.Show("Failed to create crash report." + Environment.NewLine +
                                "Here is some information to help the developers figure out why:" + Environment.NewLine + nex + Environment.NewLine + "Crash information:" + Environment.NewLine + ex);
            }
        }
コード例 #3
0
ファイル: CrashHandler.cs プロジェクト: samjaninf/chummer5a
        public static void WebMiniDumpHandler(Exception ex)
        {
            try
            {
                DumpData dump = new DumpData(ex);
                dump.AddFile(Path.Combine(Utils.GetStartupPath, "settings", "default.xml"));
                dump.AddFile(Path.Combine(Utils.GetStartupPath, "chummerlog.txt"));

                byte[] info = new UTF8Encoding(true).GetBytes(dump.SerializeBase64());
                File.WriteAllBytes(Path.Combine(Utils.GetStartupPath, "json.txt"), info);

                if (GlobalOptions.UseLoggingApplicationInsights >= UseAILogging.Crashes)
                {
                    if (Program.ChummerTelemetryClient != null)
                    {
                        ex.Data.Add("IsCrash", bool.TrueString);
                        ExceptionTelemetry et = new ExceptionTelemetry(ex)
                        {
                            SeverityLevel = SeverityLevel.Critical
                        };
                        //we have to enable the uploading of THIS message, so it isn't filtered out in the DropUserdataTelemetryProcessos
                        foreach (DictionaryEntry d in ex.Data)
                        {
                            if ((d.Key != null) && (d.Value != null))
                            {
                                et.Properties.Add(d.Key.ToString(), d.Value.ToString());
                            }
                        }
                        Program.ChummerTelemetryClient.TrackException(et);
                        Program.ChummerTelemetryClient.Flush();
                    }
                }

                //Process crashHandler = Process.Start("crashhandler", "crash " + Path.Combine(Utils.GetStartupPath, "json.txt") + " --debug");
                Process crashHandler = Process.Start("crashhandler", "crash " + Path.Combine(Utils.GetStartupPath, "json.txt"));

                crashHandler?.WaitForExit();
            }
            catch (Exception nex)
            {
                Program.MainForm.ShowMessageBox(new StringBuilder()
                                                .AppendLine("Failed to create crash report.")
                                                .AppendLine("Here is some information to help the developers figure out why:")
                                                .AppendLine(nex.ToString())
                                                .AppendLine("Crash information:")
                                                .Append(ex).ToString());
            }
        }
コード例 #4
0
        internal static void WebMiniDumpHandler(Exception ex)
        {
            try
            {
                DumpData dump = new DumpData();

                dump.AddException(ex);
                dump.AddFile(Path.Combine(Application.StartupPath, "settings", "default.xml"));
                dump.AddFile(Path.Combine(Application.StartupPath, "chummerlog.txt"));

                Process crashHandler = Process.Start("crashhandler", "crash " + dump.SerializeBase64());

                crashHandler.WaitForExit();
            }
            catch (Exception nex)
            {
                MessageBox.Show("Failed to create crash report.\nHere is some information to help the developers figure out why\n" + nex + "\nCrash information:\n" + ex);
            }
        }
コード例 #5
0
        public static void WebMiniDumpHandler(Exception ex)
        {
            try
            {
                DumpData dump = new DumpData(ex);
                dump.AddFile(Path.Combine(Application.StartupPath, "settings", "default.xml"));
                dump.AddFile(Path.Combine(Application.StartupPath, "chummerlog.txt"));

                byte[] info = new UTF8Encoding(true).GetBytes(dump.SerializeBase64());
                File.WriteAllBytes(Path.Combine(Application.StartupPath, "json.txt"), info);

                //Process crashHandler = Process.Start("crashhandler", "crash " + Path.Combine(Application.StartupPath, "json.txt") + " --debug");
                Process crashHandler = Process.Start("crashhandler", "crash " + Path.Combine(Application.StartupPath, "json.txt"));

                crashHandler?.WaitForExit();
            }
            catch (Exception nex)
            {
                MessageBox.Show("Failed to create crash report." + Environment.NewLine +
                                "Here is some information to help the developers figure out why:" + Environment.NewLine + nex + Environment.NewLine + "Crash information:" + Environment.NewLine + ex);
            }
        }
コード例 #6
0
ファイル: CrashHandler.cs プロジェクト: rmmonster/chummer5a
        internal static void WebMiniDumpHandler(Exception ex)
        {
            if (MessageBox.Show("Chummer5a crashed.\nDo you want to send a crash report to the developer?", "Crash!", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                try
                {
                    DumpData dump = new DumpData();

                    dump.AddException(ex);
                    dump.AddFile(Path.Combine(Environment.CurrentDirectory, "settings", "default.xml"));
                    dump.AddFile(Path.Combine(Environment.CurrentDirectory, "chummerlog.txt"));

                    Process crashHandler = Process.Start("crashhandler", "crash " + dump.SerializeBase64());

                    crashHandler.WaitForExit();
                }
                catch (Exception nex)
                {
                    MessageBox.Show("Failed to create crash report.\nHere is some information to help the developers figure out why\n" + nex + "\nCrash information:\n" + ex);
                }
            }
        }
コード例 #7
0
ファイル: CrashHandler.cs プロジェクト: kommlink/chummer5a
        internal static void WebMiniDumpHandler(Exception ex)
        {
            if (true || MessageBox.Show("Chummer5a crashed.\nDo you want to send a crash report to the developer?", "Crash!", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                try
                {
                    DumpData dump = new DumpData();

                    dump.AddException(ex);
                    dump.AddFile(Path.Combine(Environment.CurrentDirectory, "settings", "default.xml"));
                    dump.AddFile(Path.Combine(Environment.CurrentDirectory, "chummerlog.txt"));


                    Process crashHandler = Process.Start("crashhandler", "crash " + dump.SerializeBase64());

                    crashHandler.WaitForExit();
                }
                catch
                {
                    MessageBox.Show("Failed to create crash report.\nMake sure your system is connected to the internet.");
                }
            }
        }