microsoft / microsoft/vscode-dotnettools

Copilot PostToolUse hook fails when Windows user profile path contains a space

Open Beginner friendly
#3,563 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
No language data
Stars
321
Forks
54
Avg merge
2d 19h
Merged PRs (30d)
2

Description

Describe the issue

On Windows, C# Dev Kit’s Copilot PostToolUse hook fails because its PowerShell script path is invoked without quoting. My user profile is C:\Users\Jeremy Edwards, and PowerShell attempts to execute C:\Users\Jeremy as the command.

The installed extension’s src/copilot/plugin/hooks/hooks.json defines the PowerShell hook as:

"${PLUGIN_ROOT}/scripts/track-skill-invocation.ps1"

The GitHub Copilot Chat Hooks log shows the expanded command beginning:

c:\Users\Jeremy Edwards\.vscode\extensions\ms-dotnettools.csdevkit-3.40.204-win32-x64\src\copilot\plugin/scripts/track-skill-invocation.ps1

The hook then reports NonBlockingError with:

c:\Users\Jeremy : The term 'c:\Users\Jeremy' is not recognized as the name of a cmdlet, function, script file, or operable program.

Expected: the hook runner invokes the complete script path successfully, including spaces.

Actual: the path is split at the space in the Windows profile name. The failure repeats on PostToolUse calls. It is non-blocking, but the skill-invocation tracking hook does not run.

Please ensure the expanded PowerShell hook path is invoked as one path argument—for example, with PowerShell’s call operator and appropriate quoting—or otherwise make the hook invocation safe for Windows paths containing spaces.

Collect logs

This output is from the `Github Copilot Chat Logs.log" file:

2026-09-18 23:39:30.897 [info] [#1316] [PostToolUse] Executing 1 hook(s)
2026-09-18 23:39:30.897 [info] [#1316] [PostToolUse] Running: {"command":"c:\\Users\\Jeremy Edwards\\.vscode\\extensions\\ms-dotnettools.csdevkit-3.40.204-win32-x64\\src\\copilot\\plugin/scripts/track-skill-invocation.ps1","cwd":{"$mid":1,"fsPath":"c:\\repos\\jedwardstech\\dernise","_sep":1,"external":"file:///c%3A/repos/jedwardstech/dernise","path":"/c:/repos/jedwardstech/dernise","scheme":"file"},"env":{"PLUGIN_ROOT":"c:\\Users\\Jeremy Edwards\\.vscode\\extensions\\ms-dotnettools.csdevkit-3.40.204-win32-x64\\src\\copilot\\plugin"}}
2026-09-18 23:39:30.898 [info] [#1316] [PostToolUse] Input: {"timestamp":"2026-09-18T22:39:30.891Z","hook_event_name":"PostToolUse","session_id":"3b69e723-51ce-4bab-8271-59c7d0aebcc0","transcript_path":"c:\\Users\\Jeremy Edwards\\AppData\\Roaming\\Code\\User\\workspaceStorage\\5c71f5e3e5ece0cd41fe3c6bc25daea9\\GitHub.copilot-chat\\transcripts\\3b69e723-51ce-4bab-8271-59c7d0aebcc0.jsonl","tool_name":"run_in_terminal","tool_input":"...","tool_response":"[Output too large (45KB). Full output saved to: c:\\Users\\Jeremy Edwards\\AppData\\Roaming\\Code\\copilot-terminal-output\\copilot-terminal-output-932aa48e-eff9-4063-8df3-be7193ebd355.txt]\n[Use readFile or grep to examine the full output.]\n\nPS C:\\repos\\jedwardstech\\dernise> \n+\n+        REDACTED","tool_use_id":"call_yAJFnBgYkGYLwpPJGY3licZP__vscode-1789763851047","cwd":"c:\\repos\\jedwardstech\\dernise"}
2026-09-18 23:39:31.316 [info] [#1316] [PostToolUse] Completed (NonBlockingError) in 424ms
2026-09-18 23:39:31.316 [info] [#1316] [PostToolUse] Output: c:\Users\Jeremy : The term 'c:\Users\Jeremy' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try 
again.
At line:1 char:1
+ c:\Users\Jeremy Edwards\.vscode\extensions\ms-dotnettools.csdevkit-3. ...
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (c:\Users\Jeremy:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Steps to reproduce

You need to run this on a computer with a space in the user-profile folder... yes, yes, yes, I know, who would have a space in their user-profile folder? Well, thank Windows for creating it when I entered my name during Windows Setup.

Expected behavior

It is supposed to run the hook without error.

Environment information
  • C# Dev Kit extension: ms-dotnettools.csdevkit version 3.40.204
  • Windows user profile: C:\Users\Jeremy Edwards
  • VS Code with GitHub Copilot Chat

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/copilot/plugin/hooks/hooks.json and the referenced scripts/track-skill-invocation.ps1, then reproduce the PostToolUse hook on Windows with a user-profile path containing spaces. Done means the complete script path is invoked successfully and the Copilot Chat Hooks log no longer reports NonBlockingError.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell, vscode
Domain
devtools, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.