🔒 Fix the Meta Test build (vulnerable packages + CS9113 in scaffolds) - #631
Merged
Conversation
NuGet audit flagged four packages, and TreatWarningsAsErrors turns NU1902/NU1903 into errors in Release, so every Release build failed at restore. - OpenTelemetry exporter/hosting 1.15.0 -> 1.15.3, which also pulls OpenTelemetry.Api up to 1.15.3. The Instrumentation.* packages version independently and have no 1.15.3, so they stay put. - Microsoft.OpenApi and MessagePack are transitive only, so each needs a direct PackageReference for the pinned version to take effect. Same approach already used for KubernetesClient. Co-authored-by: Claude <noreply@anthropic.com>
The Roslyn shipped in SDK 10.0.3xx reports CS9113 for the scaffold's unread dbContext parameter (10.0.2xx did not), and TreatWarningsAsErrors turns that into an error, so the meta test failed as soon as it built a generated query. Suppressing CS9113 only around the scaffolded handler keeps the diagnostic active for real code, where an unused injected dependency is worth flagging. Co-authored-by: Claude <noreply@anthropic.com>
AntPolkanov
marked this pull request as ready for review
July 27, 2026 11:33
AntPolkanov
enabled auto-merge (squash)
July 27, 2026 11:41
danielmackay
approved these changes
Jul 27, 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.
✏️ The Meta Test workflow has been red on
mainsince #624 (12 Jun), so every PR inherits a failing check - e.g. #630, a docs-only PR. Nothing in those PRs caused it; both problems below are pre-existing onmain.✏️ Two independent problems, both of which only bite in Release because
Directory.Build.propssetsTreatWarningsAsErrorsthere.1. Vulnerable transitive packages (34 restore errors)
NuGet audit turned four packages into
NU1902/NU1903errors, failing restore before compilation:OpenTelemetry.Exporter.OpenTelemetryProtocolOpenTelemetry.Extensions.HostingOpenTelemetry.Apipast GHSA-g94r-2vxg-569jMicrosoft.OpenApiMessagePackNotes on the choices:
Microsoft.OpenApiandMessagePackare transitive only (Microsoft.AspNetCore.OpenApi→Microsoft.OpenApi;Aspire.Hosting→StreamJsonRpc→MessagePack). Under CPM aPackageVersionalone does nothing for a transitive package, so each also gets a directPackageReference- the same workaround already in place forKubernetesClient. Both are markedTODOto remove once upstream bumps.Microsoft.AspNetCore.OpenApidoes not help - even 10.0.10 still declaresMicrosoft.OpenApi 2.0.0, so Dependabot's #619 would not have fixed this.OpenTelemetry.Instrumentation.*packages version independently and have no 1.15.3 - bumping them to match producedNU1603. They stay at 1.15.0 and resolveOpenTelemetry.Apito 1.15.3 through the exporter anyway.MessagePackstays on the 2.5 line; 3.x is a major bump thatStreamJsonRpc 2.22.23is not built against.2.
CS9113: Parameter 'dbContext' is unreadin the generated scaffoldsOnce restore succeeded,
Build after a querystill failed. The query/command item templates injectIApplicationDbContext dbContextinto a handler whose body isthrow new NotImplementedException(), so the parameter is never read.This is a toolchain regression, not a template change - the scaffolds have not changed since #439. Verified by building the same generated file on both SDKs:
CI resolves 10.0.302, which is why the last green run was 10 Mar.
CS9113is suppressed around the scaffolded handler only, rather than added to the globalNoWarnlist. A template propagates to every downstream consumer, and an unused injected dependency in real code is worth flagging - so the diagnostic stays on everywhere except the stub, where the comment tells the developer to delete the pragmas once they usedbContext.Test plan
Ran the full Meta Test locally on SDK 10.0.302 (the exact version CI resolves):
Also on this branch:
dotnet test --configuration Release- 34 domain + 9 architecture + 10 integration tests pass.Microsoft.OpenApi 2.7.5,MessagePack 2.5.302,OpenTelemetry.Api 1.15.3across all projects.Microsoft.OpenApiahead of the versionMicrosoft.AspNetCore.OpenApi 10.0.3was compiled against is the one real runtime risk here, since a break would surface only when the document is generated.MapOpenApi()is unconditional inProgram.csbut no test covered it, so I added a temporary integration test hitting/openapi/v1.json- it returned a valid document containing/api/teams. Removed again before committing, though it may be worth adding for real in a follow-up.✏️ N/A