Open
Description
Description
.NET diagnostics client fails when path to dump file has spaces in it. This reproduces both on net8 and net9, and fails with error:
[createdump] The pid argument is no longer supported coming from here
It can be fixed by wrapping the path to extra ""
.
I am using the latest version of the client package.
Reproduction Steps
<!-- file DumpError.csproj -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.547301" />
</ItemGroup>
</Project>
// file Program.cs
using Microsoft.Diagnostics.NETCore.Client;
using System.Diagnostics;
public static class Program
{
public static int Main(string[] args)
{
if (args.Length > 0 && args[0] == "--hang")
{
Thread.Sleep(int.MaxValue);
}
var path = Path.Combine(AppContext.BaseDirectory, "DumpError.exe");
Process? process = null;
try
{
process = Process.Start(path, "--hang");
var diagnosticClient = new DiagnosticsClient(process.Id);
Thread.Sleep(1_000);
diagnosticClient.WriteDump(DumpType.Full, $"{Path.Combine(AppContext.BaseDirectory, $"my dump with spaces {Stopwatch.GetTimestamp()}.dmp")}", logDumpGeneration: true);
}
finally
{
process?.Kill();
}
return 0;
}
}
Expected behavior
Spaces are correctly escaped and my dump is written to disk.
Actual behavior
[createdump] The pid argument is no longer supported error is shown and dump is not written.
Regression?
No.
Known Workarounds
Add quotes around the path, or move to folder without spaces.
Configuration
Win 11, 8.0.110, but reproduces on latest net9 as well.
Other information
No response