Improve .NET SDK build infrastructure and documentation#643
Merged
patniko merged 5 commits intogithub:mainfrom Mar 5, 2026
Merged
Improve .NET SDK build infrastructure and documentation#643patniko merged 5 commits intogithub:mainfrom
patniko merged 5 commits intogithub:mainfrom
Conversation
Collaborator
stephentoub
commented
Mar 3, 2026
- Add Central Package Management (Directory.Packages.props) with all package versions centralized
- Add Directory.Build.props with shared properties (TargetFramework, ImplicitUsings, Nullable, TreatWarningsAsErrors)
- Add nuget.config with single nuget.org source and package source mapping (required by CPM)
- Add global.json specifying .NET 10 SDK (the library is still built with a net8.0 TFM)
- Update all CI workflows from .NET 8.0.x to .NET 10.0.x
- Enable XML documentation file generation (GenerateDocumentationFile) so that comments are validated and IntelliSense docs are generated
- Add XML doc comments to all non-generated public types and members
- Add valid-value lists in XML docs for string properties with known values (e.g. PermissionRequest.Kind, ToolResultObject.ResultType)
- Add #pragma warning disable CS1591 to generated files (SessionEvents.cs, Rpc.cs) and codegen scripts
- Enable EmbedUntrackedSources, IncludeSymbols, SymbolPackageFormat
- Enable ContinuousIntegrationBuild conditional on CI/TF_BUILD environment variables
- Add PackageProjectUrl to package metadata
- Add [EditorBrowsable(Never)] to obsolete GithubToken property
- Upgrade analysis level and fix some diagnostics
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes the .NET SDK’s build/tooling setup (centralized package/version management, updated SDK tooling in CI) and improves public API documentation by enabling XML doc generation and adding XML docs across the SDK (with CS1591 suppression for generated code).
Changes:
- Introduce Central Package Management + shared build props (TFM/lang/analyzers/warnings-as-errors) and add NuGet source mapping + dotnet/global.json.
- Update CI workflows to use .NET 10 SDK and adjust codegen to suppress CS1591 in generated C# files.
- Add/expand XML documentation across public .NET SDK types and tighten some implementation details (logging, parsing, small refactors).
Reviewed changes
Copilot reviewed 25 out of 27 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/codegen/csharp.ts | Suppress CS1591 in generated C# and tweak default initializers for generated types. |
| nodejs/scripts/update-protocol-version.ts | Adjust generated C# protocol version constant visibility. |
| dotnet/test/ToolsTests.cs | Test refactors and modern C# syntax changes (incl. permission handler). |
| dotnet/test/SessionTests.cs | Use collection expressions for AvailableTools/ExcludedTools in tests. |
| dotnet/test/Harness/E2ETestContext.cs | Seal type + expand expression-bodied members for style/analyzer compliance. |
| dotnet/test/Harness/E2ETestBase.cs | Expand expression-bodied members and update collection initialization style. |
| dotnet/test/Harness/CapiProxy.cs | Seal type + collection expression usage and expanded DisposeAsync. |
| dotnet/test/GitHub.Copilot.SDK.Test.csproj | Move package versions to CPM (remove Version=...). |
| dotnet/test/ClientTests.cs | Minor test cleanup (collection expressions, ThrowsAsync simplification). |
| dotnet/src/Types.cs | Add extensive XML docs and modernize initializers; adjust API metadata attributes. |
| dotnet/src/Session.cs | Seal session class + refactors (handlers, initializers, formatting). |
| dotnet/src/SdkProtocolVersion.cs | Hide constant and expose accessor; formatting changes. |
| dotnet/src/GitHub.Copilot.SDK.csproj | Enable XML docs + add pack/sourcelink/CI build metadata; move to CPM. |
| dotnet/src/Generated/SessionEvents.cs | Suppress CS1591 and small formatting changes. |
| dotnet/src/Generated/Rpc.cs | Suppress CS1591 and update empty collection initialization style. |
| dotnet/src/Client.cs | Seal client class + logging/formatting/culture tweaks; regex source-gen; minor refactors. |
| dotnet/samples/Chat.csproj | Remove duplicated per-project props now covered by Directory.Build.props. |
| dotnet/nuget.config | Add single source + package source mapping for CPM. |
| dotnet/global.json | Pin .NET SDK selection for dotnet/ folder builds. |
| dotnet/Directory.Packages.props | Centralize NuGet package versions for dotnet projects. |
| dotnet/Directory.Build.props | Centralize shared build settings (TFM, LangVersion, analyzers, warnings-as-errors). |
| .github/workflows/update-copilot-dependency.yml | Update CI to install .NET 10. |
| .github/workflows/scenario-builds.yml | Update CI to install .NET 10. |
| .github/workflows/publish.yml | Update CI to install .NET 10. |
| .github/workflows/dotnet-sdk-tests.yml | Update CI to install .NET 10. |
| .github/workflows/docs-validation.yml | Update CI to install .NET 10. |
| .github/workflows/copilot-setup-steps.yml | Update CI to install .NET 10. |
- Add Central Package Management (Directory.Packages.props) with all package versions centralized - Add Directory.Build.props with shared properties (TargetFramework, ImplicitUsings, Nullable, TreatWarningsAsErrors) - Add nuget.config with single nuget.org source and package source mapping (required by CPM) - Add global.json specifying .NET 10 SDK (the library is still built with a net8.0 TFM) - Update all CI workflows from .NET 8.0.x to .NET 10.0.x - Enable XML documentation file generation (GenerateDocumentationFile) - Add XML doc comments to all non-generated public types and members - Add valid-value lists in XML docs for string properties with known values (e.g. PermissionRequest.Kind, ToolResultObject.ResultType) - Add #pragma warning disable CS1591 to generated files (SessionEvents.cs, Rpc.cs) and codegen scripts - Enable EmbedUntrackedSources, IncludeSymbols, SymbolPackageFormat - Enable ContinuousIntegrationBuild conditional on CI/TF_BUILD environment variables - Add PackageProjectUrl to package metadata - Add [EditorBrowsable(Never)] to obsolete GithubToken property - Upgrade analysis level and fix some diagnostics
dc1049d to
f4b9908
Compare
Changes to development utility scripts (codegen, protocol version updates) should not trigger the Node.js test suite, as they don't affect SDK runtime code and the workflow fails on fork PRs that lack the COPILOT_HMAC_KEY secret. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These tests verify that the correct parameters are forwarded to the RPC call, not that the CLI handles them. Mock sendRequest (like the setModel test already does) so the tests don't depend on CLI authentication, which is unavailable on fork PRs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
@stephentoub mind resolving conflicts? Happy to take this after the checks clear. |
…uild # Conflicts: # dotnet/src/Types.cs # dotnet/test/Harness/E2ETestContext.cs # dotnet/test/ToolsTests.cs # nodejs/test/client.test.ts
Collaborator
Author
Done, thanks |
Use PermissionRequestResultKind.Approved instead of string literal "approved" to match the strongly-typed struct in the .NET SDK. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
patniko
approved these changes
Mar 5, 2026
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.