[.NET] CreateProcess fails when Copilot CLI is installed via npm (copilot.cmd)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
Research direction
Start with StartCliServerAsync and the existing ResolveCliCommand entry point described in the issue, then reproduce the failure on Windows with a globally npm-installed Copilot CLI. Compare the .NET process launch behavior with the Python SDK fix and verify that the SDK can start the copilot.cmd installation while preserving the existing .js handling.
Written by the indexing model from the issue text.
Description
Problem
On Windows, when the Copilot CLI is installed via npm, the only executables on PATH are copilot (extensionless) and copilot.cmd. There is no copilot.exe.
The .NET SDK's StartCliServerAsync uses ProcessStartInfo with UseShellExecute = false, which calls CreateProcess under the hood. CreateProcess cannot resolve .cmd/.bat files — it only finds native executables (.exe, .com). This results in:
System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'copilot'
with working directory '...'. The system cannot find the file specified.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at GitHub.Copilot.SDK.CopilotClient.StartCliServerAsync(...)
Running copilot in a terminal works fine because PowerShell/cmd.exe use PATHEXT to resolve .cmd wrappers. But the SDK's CreateProcess does not.
Output of where.exe copilot on affected machines:
C:\ProgramData\global-npm\copilot
C:\ProgramData\global-npm\copilot.cmd
This was already fixed in the Python SDK
PR #338 fixed the same issue for the Python SDK by using shutil.which() to resolve the full CLI path before spawning the subprocess.
Suggested fix for .NET
The SDK already has ResolveCliCommand which handles .js files by prepending node:
private static (string FileName, IEnumerable<string> Args) ResolveCliCommand(string cliPath, IEnumerable<string> args)
{
if (cliPath.EndsWith(".js", StringComparison.OrdinalIgnoreCase))
{
return ("node", new[] { cliPath }.Concat(args));
}
return (cliPath, args);
}
A similar approach for .cmd files (prepending cmd.exe /c) would work. Alternatively, resolve the PATH using PATHEXT-aware logic before passing to ProcessStartInfo.
Environment
- SDK: GitHub.Copilot.SDK 0.1.32 (NuGet)
- OS: Windows 11
- CLI install method: npm (global)
- Dominant language
- Java
- Stars
- 10.5k
- Forks
- 1.5k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 131
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/copilot-sdk
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/copilot-sdk#2709 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
github/copilot-sdk#2673 ·
-
bug testing
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
github/copilot-sdk#2628 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/copilot-sdk#2627 · 1 comment ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
github/copilot-sdk#2493 ·
All issues in github/copilot-sdk
Similar issues
-
bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
opensearch-project/ml-commons#5094 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
emitter:client:csharp feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100