Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,15 @@ private static IpcMessage CreateWriteDumpMessage(DumpType dumpType, string dumpP
throw new ArgumentNullException($"{nameof(dumpPath)} required");
}

byte[] payload = SerializePayload(dumpPath, (uint)dumpType, logDumpGeneration);
// Quote the path to handle spaces correctly in createdump on Windows only
// Only add quotes if the path is not already quoted
// This is only needed on Windows where the runtime builds the command line for createdump
string pathToUse = dumpPath;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
pathToUse = dumpPath.StartsWith("\"") && dumpPath.EndsWith("\"") ? dumpPath : $"\"{dumpPath}\"";
}
byte[] payload = SerializePayload(pathToUse, (uint)dumpType, logDumpGeneration);
return new IpcMessage(DiagnosticsServerCommandSet.Dump, (byte)DumpCommandId.GenerateCoreDump, payload);
}

Expand All @@ -709,7 +717,15 @@ private static IpcMessage CreateWriteDumpMessage(DumpCommandId command, DumpType
throw new ArgumentNullException($"{nameof(dumpPath)} required");
}

byte[] payload = SerializePayload(dumpPath, (uint)dumpType, (uint)flags);
// Quote the path to handle spaces correctly in createdump on Windows only
// Only add quotes if the path is not already quoted
// This is only needed on Windows where the runtime builds the command line for createdump
string pathToUse = dumpPath;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
pathToUse = dumpPath.StartsWith("\"") && dumpPath.EndsWith("\"") ? dumpPath : $"\"{dumpPath}\"";
}
byte[] payload = SerializePayload(pathToUse, (uint)dumpType, (uint)flags);
return new IpcMessage(DiagnosticsServerCommandSet.Dump, (byte)command, payload);
}

Expand Down