Fix DiagnosticsClient.WriteDump to handle dump paths with spaces on Windows#5593
Merged
Fix DiagnosticsClient.WriteDump to handle dump paths with spaces on Windows#5593
Conversation
Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix diagnostics client dump creation with paths containing spaces
Fix DiagnosticsClient.WriteDump to handle dump paths with spaces
Oct 8, 2025
Member
|
@copilot from the comments on the issue this PR is linked to, the quote behavior was only needed on windows. The non-windows targets did not have this problem. |
Contributor
Author
Updated the fix to apply quoting only on Windows. The path quoting is now wrapped in a |
Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Copilot
AI
changed the title
Fix DiagnosticsClient.WriteDump to handle dump paths with spaces
Fix DiagnosticsClient.WriteDump to handle dump paths with spaces on Windows
Oct 9, 2025
lateralusX
approved these changes
Oct 16, 2025
hoyosjs
added a commit
that referenced
this pull request
Apr 2, 2026
Copilot aided release notes for user facing changes --------------------------------------------------------------------- Breaking Changes - COMPLUS_* environment variable references removed from SOS — use DOTNET_* equivalents (#5714) - !name2ee and !token2ee output is now less verbose; modules that don't contain the requested type are no longer listed (#5719) dotnet-dump / SOS New features: - Add -stat flag to !threadpool to summarize queued work items by type (#5737) - Add sort-by-count option to !dumpheap (#5722) - Add -noprogress flag to !dumpheap and !verifyheap to suppress progress reporting (#5773) - Add -all flag to DumpMT to show class details and method descriptors in one command (#5701) - !DumpStackObjects now finds objects correctly during stack overflow scenarios on Linux (#5723) - Warn when loading a dump not collected by createdump, as SOS commands may produce incomplete results (#5720) - SOS output is now captured correctly by LLDB Python scripts and tools like lldb-dap (#5728) Bug fixes: - Fix !u failing on IL stubs (#5726) - Fix DumpIL showing a cryptic error on IL stubs — now explains IL is unavailable (#5731) - Fix clrstack -l displaying incorrect values for ushort locals ≥ 0x8000 (#5721) dotnet-trace / collect-linux - Enable callstack capture for .NET runtime events in collect-linux — exception and GC stacks now include resolved frames (#5756) - collect-linux --probe now gracefully handles unreachable processes instead of throwing (#5705) - Fix crash in collect-linux in environments without terminal cursor support (#5771) - Fix collect-linux throwing when stdin/stdout are redirected (e.g. piped or scripted) (#5745) - Fix terminal cursor not being restored after collect-linux exits (#5747, #5707) dotnet-counters - Add --noAbbreviateValues option to monitor to display full-precision values without K/M/G abbreviation (#5734) Diagnostic Tools (general) - Fix WriteDump failing when the dump path contains spaces on Windows (#5593) - Diagnostic tools now work from sidecar containers — dotnet-trace, dotnet-counters, dotnet-stack, and dotnet-dump can attach to processes in other containers without manual socket configuration (#5735) Libraries - Improved symbol resolution performance by caching failed lookups (#5729) - Symbol server key generation now supports ELF binaries from custom toolchains (#5736)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5020 -
DiagnosticsClient.WriteDump()now correctly handles dump file paths containing spaces on Windows.Problem
When calling
WriteDump()with a path containing spaces on Windows, the operation would fail with the error:This occurred because the runtime's
createdumputility on Windows was parsing the unquoted path as multiple command-line arguments. For example, a path likeC:\my dumps\dump.dmpwould be split intoC:\myanddumps\dump.dmp, causing the latter part to be misinterpreted as additional arguments.This issue is specific to Windows due to how the runtime builds the command line for createdump. Linux and macOS do not have this problem.
Solution
The fix wraps the dump path in quotes before sending it to the runtime on Windows only:
C:\my dumps\dump.dmp→"C:\my dumps\dump.dmp"Changes
Modified the two
CreateWriteDumpMessagemethod overloads inDiagnosticsClient.csto:RuntimeInformation.IsOSPlatform(OSPlatform.Windows)Testing
Manually verified the quoting logic handles:
On Windows:
C:\dumps\dump.dmp→"C:\dumps\dump.dmp"C:\my dumps\dump.dmp→"C:\my dumps\dump.dmp"(fixes the issue)"C:\my dumps\dump.dmp"→"C:\my dumps\dump.dmp"(no double-quoting)On Linux/macOS:
The fix is minimal, backward compatible, platform-specific, and addresses the reported issue while maintaining compatibility with the workaround mentioned in the issue.
Fixes #5020
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.