Crash Report Changes

- removed the dumplog as it is never used.
This commit is contained in:
Brett Hewitson 2022-07-16 13:56:10 +10:00
parent 5fff2abc91
commit 08b93429a5
2 changed files with 5 additions and 91 deletions

View file

@ -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();
}
}
}