From 08b93429a5919d66aae46c89a440ed4aefcdb26f Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Sat, 16 Jul 2022 13:56:10 +1000 Subject: [PATCH] Crash Report Changes - removed the dumplog as it is never used. --- src/ARKServerManager/ErrorHandling.cs | 49 ++----------------------- src/ConanServerManager/ErrorHandling.cs | 47 +----------------------- 2 files changed, 5 insertions(+), 91 deletions(-) diff --git a/src/ARKServerManager/ErrorHandling.cs b/src/ARKServerManager/ErrorHandling.cs index e8518a7f..49377d95 100644 --- a/src/ARKServerManager/ErrorHandling.cs +++ b/src/ARKServerManager/ErrorHandling.cs @@ -2,11 +2,9 @@ using System.Diagnostics; using System.IO; using System.Reflection; -using System.Runtime.InteropServices; using System.Text; using System.Windows; using ServerManagerTool.Common.Utils; -using ServerManagerTool.Lib; namespace ServerManagerTool { @@ -18,23 +16,17 @@ namespace ServerManagerTool // Write out a log file with all the details so users can send us the info... var file = Path.GetTempFileName(); - var crashFile = file + ".dmp"; - - try - { - MiniDumpToFile(crashFile); - } - catch { } try { var details = new StringBuilder(); - details.AppendLine("ARK Server Manager Crash Report"); + details.AppendLine("Server Manager Crash Report"); details.AppendLine($"Please report this crash to the Server Manager discord - {Config.Default.DiscordUrl}"); details.AppendLine(); details.AppendLine($"Assembly: {Assembly.GetExecutingAssembly()}"); details.AppendLine($"Version: {App.Instance.Version}"); + details.AppendLine($"Code: {Config.Default.ServerManagerCode}"); details.AppendLine($"IsAdministrator: {SecurityUtils.IsAdministrator()}"); details.AppendLine(); @@ -42,9 +34,6 @@ namespace ServerManagerTool details.AppendLine($"Windows Version: {Environment.OSVersion.VersionString}"); details.AppendLine(); - details.AppendLine($"Crash Dump: {crashFile}"); - details.AppendLine(); - var exception = e.ExceptionObject as Exception; if (exception != null) { @@ -61,13 +50,12 @@ namespace ServerManagerTool var message = new StringBuilder(); message.AppendLine("OOPS! ARK Server Manager has suffered from an internal error and must shut down, this is probably a bug and should be reported. The error files are:"); message.AppendLine($"Error File: {file}"); - message.AppendLine($"Crash Dump: {crashFile}"); details.AppendLine(); details.AppendLine(); message.AppendLine($"Please report this crash to the Server Manager discord - {Config.Default.DiscordUrl}"); message.AppendLine("The crash log will now be opened in notepad."); - var result = MessageBox.Show(message.ToString(), "ARK Server Manager crashed", MessageBoxButton.OK, MessageBoxImage.Exclamation); + var result = MessageBox.Show(message.ToString(), "Server Manager crashed", MessageBoxButton.OK, MessageBoxImage.Exclamation); if (result == MessageBoxResult.OK) { Process.Start("notepad.exe", file); @@ -82,36 +70,5 @@ namespace ServerManagerTool catch { } } } - - internal enum MinidumpType - { - MiniDumpNormal = 0x00000000, - MiniDumpWithDataSegs = 0x00000001, - MiniDumpWithFullMemory = 0x00000002, - MiniDumpWithHandleData = 0x00000004, - MiniDumpFilterMemory = 0x00000008, - MiniDumpScanMemory = 0x00000010, - MiniDumpWithUnloadedModules = 0x00000020, - MiniDumpWithIndirectlyReferencedMemory = 0x00000040, - MiniDumpFilterModulePaths = 0x00000080, - MiniDumpWithProcessThreadData = 0x00000100, - MiniDumpWithPrivateReadWriteMemory = 0x00000200, - MiniDumpWithoutOptionalData = 0x00000400, - MiniDumpWithFullMemoryInfo = 0x00000800, - MiniDumpWithThreadInfo = 0x00001000, - MiniDumpWithCodeSegs = 0x00002000 - } - - [DllImport("dbghelp.dll")] - static extern bool MiniDumpWriteDump(IntPtr hProcess, Int32 ProcessId, IntPtr hFile, MinidumpType DumpType, IntPtr ExceptionParam, IntPtr UserStreamParam, IntPtr CallackParam); - - public static void MiniDumpToFile(String fileToDump) - { - var fsToDump = File.Create(fileToDump); - - Process thisProcess = Process.GetCurrentProcess(); - MiniDumpWriteDump(thisProcess.Handle, thisProcess.Id, fsToDump.SafeFileHandle.DangerousGetHandle(), MinidumpType.MiniDumpWithFullMemory, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); - fsToDump.Close(); - } } } diff --git a/src/ConanServerManager/ErrorHandling.cs b/src/ConanServerManager/ErrorHandling.cs index d4c3f468..27dca4d1 100644 --- a/src/ConanServerManager/ErrorHandling.cs +++ b/src/ConanServerManager/ErrorHandling.cs @@ -1,11 +1,10 @@ -using ServerManagerTool.Common.Utils; -using System; +using System; using System.Diagnostics; using System.IO; using System.Reflection; -using System.Runtime.InteropServices; using System.Text; using System.Windows; +using ServerManagerTool.Common.Utils; namespace ServerManagerTool { @@ -17,13 +16,6 @@ namespace ServerManagerTool // Write out a log file with all the details so users can send us the info... var file = Path.GetTempFileName(); - var crashFile = file + ".dmp"; - - try - { - MiniDumpToFile(crashFile); - } - catch { } try { @@ -42,9 +34,6 @@ namespace ServerManagerTool details.AppendLine($"Windows Version: {Environment.OSVersion.VersionString}"); details.AppendLine(); - details.AppendLine($"Crash Dump: {crashFile}"); - details.AppendLine(); - var exception = e.ExceptionObject as Exception; if (exception != null) { @@ -61,7 +50,6 @@ namespace ServerManagerTool var message = new StringBuilder(); message.AppendLine("OOPS! The Server Manager has suffered from an internal error and must shut down, this is probably a bug and should be reported. The error files are:"); message.AppendLine($"Error File: {file}"); - message.AppendLine($"Crash Dump: {crashFile}"); details.AppendLine(); details.AppendLine(); message.AppendLine($"Please report this crash to the Server Manager discord - {Config.Default.DiscordUrl}"); @@ -82,36 +70,5 @@ namespace ServerManagerTool catch { } } } - - internal enum MinidumpType - { - MiniDumpNormal = 0x00000000, - MiniDumpWithDataSegs = 0x00000001, - MiniDumpWithFullMemory = 0x00000002, - MiniDumpWithHandleData = 0x00000004, - MiniDumpFilterMemory = 0x00000008, - MiniDumpScanMemory = 0x00000010, - MiniDumpWithUnloadedModules = 0x00000020, - MiniDumpWithIndirectlyReferencedMemory = 0x00000040, - MiniDumpFilterModulePaths = 0x00000080, - MiniDumpWithProcessThreadData = 0x00000100, - MiniDumpWithPrivateReadWriteMemory = 0x00000200, - MiniDumpWithoutOptionalData = 0x00000400, - MiniDumpWithFullMemoryInfo = 0x00000800, - MiniDumpWithThreadInfo = 0x00001000, - MiniDumpWithCodeSegs = 0x00002000 - } - - [DllImport("dbghelp.dll")] - static extern bool MiniDumpWriteDump(IntPtr hProcess, Int32 ProcessId, IntPtr hFile, MinidumpType DumpType, IntPtr ExceptionParam, IntPtr UserStreamParam, IntPtr CallackParam); - - public static void MiniDumpToFile(String fileToDump) - { - var fsToDump = File.Create(fileToDump); - - Process thisProcess = Process.GetCurrentProcess(); - MiniDumpWriteDump(thisProcess.Handle, thisProcess.Id, fsToDump.SafeFileHandle.DangerousGetHandle(), MinidumpType.MiniDumpWithFullMemory, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); - fsToDump.Close(); - } } }