Skip to content

Debugging tests fail when path contains spaces using MTP #2891

@LyndonHook

Description

@LyndonHook

Describe the Issue

Running tests from VS Code with C# Dev Kit fails to start when diagnostic logging is enabled and the diagnostic output directory contains spaces.

Steps to Reproduce

  1. Create a new MSTest project in a folder whose path contains spaces: /home/<user>/src/Example Solution
  2. Ensure the test project uses MTP.
  3. Open the folder in a fresh VS Code window and wait for C# Dev Kit to discover tests.
  4. In Test Explorer, choose Debug on any test.

Expected Behaviour

The test process starts and logs diagnostics to the correct directory.

Actual Behaviour

The test host exits immediately. Output shows the diagnostic path split at spaces.

Diagnostic file (level 'Information' with async flush): /home/<user>/src/Example Solution/artifacts/build/bin/Example.Tests/debug/"/home/<user>/src/Example/log_260317001604517.diag
Option '--diagnostic-output-directory' from provider 'Platform command line provider' (UID: PlatformCommandLineProvider) expects at most 1 arguments

Evidence

With VS Code C# debug log tracing enabled, debug console shows the path quoted but escaped, so the directory is not treated as a single token.

[Start Debugging] CreateProcess((null), "/home/<user>/src/Example Solution/artifacts/build/bin/Example.Tests/debug/Example.Tests"  --server --diagnostic --diagnostic-verbosity Information --diagnostic-output-directory \"/home/<user>/src/Example Solution/artifacts/build/bin/Example.Tests/debug/Log\" --client-port 43653 , inheritHandles:0, launchFlags:0x4, currentDirectory:/home/<user>/src/Example Solution/artifacts/build/bin/Example.Tests...

Extension version: 2.10.3
VS Code version: Code 1.111.0 (ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb, 2026-03-06T23:06:10Z)
OS version: Windows_NT x64 10.0.26200
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 5 125U (14 x 2688)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x7d45 [Intel(R) Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.7026 ACTIVE
GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.7309
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.51GB (12.98GB free)
Process Argv --folder-uri=vscode-remote://wsl+Ubuntu-24.04/home/lhook/src/Cloud%20Application%20Guidelines/Canary%20API --remote=wsl+Ubuntu-24.04 --crash-reporter-id 3dadc642-0059-4492-a57b-4855c93d5ec0
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-24.04
OS Linux x64 6.6.87.2-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) Ultra 5 125U (14 x 0)
Memory (System) 15.37GB (11.87GB free)
VM 0%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
471b6256:31263136
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
63221493:31336333
envsdeactivate2:31464701
cloudbuttont:31379625
aihoversummaries_f:31469309
3efgi100_wstrepl:31403338
55ia6109:31457054
use-responses-api:31390855
je187915:31401257
linter-cursor-jump:31475312
ec5jj548:31422691
cp_cls_t_966_ss:31454198
4je02754:31466945
ge8j1254_inline_auto_hint_haiku:31431912
nes-autoexp-10:31446583
00h15499_gpt_53_codex:31464543
7a04d226_do_not_restore_last_panel_session:31438103
cp_cls_c_1081:31454833
ia-use-proxy-models-svc:31452481
a43f0574a:31442826
e9c30283:31461165
test_treatment2:31471001
nes-conv-2-3:31474331
subagent_3ccgc321:31467997
idci7584:31464702
edit_mode_hidden:31461530
864ei723_large_tool_results_to_disk:31460878
showingstats:31471631
55364912:31471672
nes-extended-on:31455476
chat:31457767
8hig5102:31473806
jdddd261:31472041
nes-rcnt-ctrl:31471618
9g0ce865_5_3_codex_prompt_disabled:31475327
cpptoolson-v2:31475363
4dgh1208:31471592
editor1:31474144
thinking_c:31471065
c3257622:31473910
commenticon:31473926
nes-notsn-1:31475122

Metadata

Metadata

Assignees

Labels

area-testTest discovery, execution, debugging

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions