-
Notifications
You must be signed in to change notification settings - Fork 646
Fix .NET CLI server mode code samples - add missing UseStdio = false #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Fixes broken .NET “CLI server mode” code samples by explicitly setting UseStdio = false when CliUrl is provided, avoiding the ArgumentException thrown by CopilotClient option validation.
Changes:
- Update .NET XML doc example in
CopilotClientto includeUseStdio = falsewhen usingCliUrl - Update .NET snippet in
docs/getting-started.mdto includeUseStdio = false
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dotnet/src/Client.cs | Updates the XML documentation example to provide valid CopilotClientOptions when using CliUrl. |
| docs/getting-started.md | Fixes the .NET getting-started example for connecting to an existing CLI server via CliUrl. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// var client = new CopilotClient(); | ||
| /// | ||
| /// // Connect to an existing server | ||
| /// var client = new CopilotClient(new CopilotClientOptions { CliUrl = "localhost:3000" }); | ||
| /// var client = new CopilotClient(new CopilotClientOptions { CliUrl = "localhost:3000", UseStdio = false }); | ||
| /// | ||
| /// // Custom CLI path with specific log level |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <example><code> block declares var client multiple times, which won’t compile if a user copies the whole snippet as-is. Consider either splitting these into separate <code> examples or using distinct variable names (e.g., defaultClient, externalClient, etc.).
See below for a potential fix:
/// var defaultClient = new CopilotClient();
///
/// // Connect to an existing server
/// var existingServerClient = new CopilotClient(new CopilotClientOptions { CliUrl = "localhost:3000", UseStdio = false });
///
/// // Custom CLI path with specific log level
/// var customPathClient = new CopilotClient(new CopilotClientOptions
✅ Cross-SDK Consistency ReviewI've reviewed this PR for consistency across all four SDK implementations (Node.js, Python, Go, and .NET). SummaryThe fix is correct and maintains consistency. The .NET SDK has the same mutually exclusive option enforcement as the other SDKs, and this PR correctly updates the documentation examples. AnalysisAll four SDKs implement identical validation logic:
Why This PR Was NeededThe .NET SDK throws an
Before this PR: Documentation examples showed only After this PR: Examples explicitly set
Documentation ConsistencyThe docs/getting-started.md file now shows all four languages with their respective conventions:
RecommendationThis PR correctly addresses a documentation bug specific to .NET's stricter validation. The fix maintains cross-SDK consistency while respecting language-specific implementation details. ✅ Approved from consistency perspective. Optional enhancement: Consider updating Python/Go documentation examples to also explicitly show the
|
Code samples showing
CliUrlusage were throwingArgumentExceptiondue to missingUseStdio = false. SinceUseStdiodefaults totrueand is mutually exclusive withCliUrl, the examples failed validation in theCopilotClientconstructor.Changes
UseStdio = falseUseStdio = falseExample
Before (throws exception):
After (correct):
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.