[Blazor] Ship Native AOT metadata generator package - #68326
Open
javiercn wants to merge 3 commits into
Open
Conversation
javiercn
force-pushed
the
javiercn-aspire-dashboard-aot-strict-proof
branch
from
August 11, 2026 11:49
7274404 to
43c0eb4
Compare
Package the metadata source generator as an explicitly referenced preview-only analyzer and validate package acquisition from external-shaped applications. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5fafb32e-4791-429a-9155-ef4c2ad36f24
Add the locally built analyzer package as an additional restore source so CI can still acquire the ASP.NET Core targeting pack from configured feeds. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5fafb32e-4791-429a-9155-ef4c2ad36f24
Keep the external analyzer-package acquisition coverage independent of Microsoft.AspNetCore.App.Ref package production by referencing the product assemblies already built for the Components test leg. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5fafb32e-4791-429a-9155-ef4c2ad36f24
javiercn
force-pushed
the
javiercn-ship-aot-metadata-generator
branch
from
August 11, 2026 12:09
9d79751 to
68e935a
Compare
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.
Overview
Completes the delivery layer of #68332 by making the Blazor Native AOT metadata generator consumable outside this repository as an explicitly referenced analyzer package. This PR is pinned from
javiercn-aspire-dashboard-aot-strict-proofat43c0eb40916741f531d856f8ed7a0f067548ae3ftojaviercn-ship-aot-metadata-generatorat68e935a405993543c831176855314ed9b55e038e(three commits, seven files); it builds on the verified strict reflection-disabled proof in #68302 and its shared MSTest/Native AOT harness, but does not automatically add the generator toMicrosoft.AspNetCore.App.Ref. The cross-cutting constraint is that the package remains preview-only and analyzer-only while existing Blazor behavior stays reflection-enabled by default.Design
The consumer contract is an explicit, non-transitive package reference:
The package has no runtime contract: it suppresses normal build output and package dependencies, then places only the Roslyn generator under the conventional analyzer path. Preview-only version properties are local to this project, so an outer RC/RTM repository version cannot accidentally stabilize the package.
This replaces both rejected delivery shapes: consumers no longer need a repository-local analyzer
ProjectReference, and the generator is not injected automatically through the ASP.NET Core targeting pack. Explicit acquisition keeps the experimental surface scoped to applications such as Aspire that deliberately adopt it.Implementation
The strict feature app retains the verified parent's source-tree framework references and shared Native AOT test-harness analyzer. This PR changes only the metadata generator acquisition from a direct analyzer project reference to the private package; it does not reintroduce the removed xUnit runner, custom native harness, targeting-pack override, or duplicated E2E orchestration.
The E2E project remains an MSTest/Microsoft.Testing.Platform executable and delegates the nested publish to the parent's shared
E2ENativeAotmachinery. A small prerequisite target packs the generator, obtains its exact computed package version, restores the app through the local shipping feed, and appends that version to the app's existing publish properties. The shared target still ownsE2ECompileTestHarness=true, the runtime identifier, publish output, and manifest generation.Package validation follows the same shared MSTest/MTP test path as the rest of the generator suite. It covers three distinct equivalence classes once each: physical package shape, external analyzer execution, and dependency isolation. The external-consumer test references product binaries already built by the Components leg, restores only the analyzer from the local package directory, proves real metadata source was emitted, then packs the consumer and verifies
PrivateAssets="all"prevents the generator from flowing into its nuspec.Generated code also owns two diagnostics surfaced by strict external-shaped builds.
BL0005is expected when generated accessors assign component parameters, andCS8620can arise from nullable substitutions on inherited generic component bases. The emitter suppresses those diagnostics only inside auto-generated source; a nullable generic-base regression test protects the latter without weakening diagnostics in user code.Outcome
43c0eb4091; both CI-fix commits retain identical stable patch IDs, while the package commit changes only for the required MSTest/shared-harness migrationTesttarget passed; direct run confirmed 119 passed, 0 failed, 0 skippedanalyzers/dotnet/cs/Microsoft.AspNetCore.Components.Endpoints.Generators.dll; nolib,ref, runtime asset, or dependency groupE2ENativeAotbuild restoredMicrosoft.AspNetCore.Components.Endpoints.Generators/11.0.0-dev, generated native code, and published with 0 warnings and 0 errorsc18c367980)173a2109escaffold still produced 89 trim/AOT analysis errors and an ILCompiler unsafe-accessor constraint crash. This does not claim validation of the laterbe77aa36Dashboard graph or its forms/auth/storage/QuickGrid/dynamic-root scenarios.