Skip to content

Add Native AOT compatibility coverage for core libraries - #7659

Merged
Nigusu-Allehu merged 3 commits into
NuGet:devfrom
eerhardt:dev-eerhardt-suppress-aot-warnings
Sep 8, 2026
Merged

Nigusu-Allehu merged 3 commits into
NuGet:devfrom
eerhardt:dev-eerhardt-suppress-aot-warnings

Conversation

@eerhardt

@eerhardt eerhardt commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Bug

Fixes:

Description

Add a Native AOT compatibility test app that roots a subset of NuGet's core libraries, publishes them with AOT analysis enabled, and runs the resulting executable in PR validation. This establishes a warning-free baseline that prevents AOT regressions while additional libraries are made compatible and added incrementally over time.

The test enables the existing System.Text.Json feature switch and uses the AOT annotations available in Newtonsoft.Json 13.0.4. Known warnings originating within Newtonsoft.Json and its dynamic runtime dependencies are reduced to assembly-level warnings and suppressed so diagnostics in NuGet-owned code remain actionable.

Replace source-only IL2026 and IL3050 pragmas with durable annotations where appropriate. Calls known to be safe use UnconditionalSuppressMessage; legacy Newtonsoft.Json paths use RequiresUnreferencedCode and RequiresDynamicCode, with narrowly scoped suppressions at feature-gated call sites that Native AOT removes.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@eerhardt
eerhardt requested a review from a team as a code owner August 26, 2026 23:41
@eerhardt
eerhardt requested review from jebriede and zivkan August 26, 2026 23:41
@dotnet-policy-service dotnet-policy-service Bot added the Community PRs created by someone not in the NuGet team label Aug 26, 2026
@eerhardt eerhardt changed the title Preserve AOT suppressions for plugin compatibility constructors Add Native AOT compatibility coverage for core libraries Aug 27, 2026
@eerhardt
eerhardt force-pushed the dev-eerhardt-suppress-aot-warnings branch from 4e29387 to 86a33bd Compare August 27, 2026 20:19
@Nigusu-Allehu Nigusu-Allehu self-assigned this Sep 1, 2026
@Nigusu-Allehu
Nigusu-Allehu self-requested a review September 1, 2026 23:13
Nigusu-Allehu
Nigusu-Allehu previously approved these changes Sep 2, 2026
Nigusu-Allehu
Nigusu-Allehu previously approved these changes Sep 3, 2026
donnie-msft
donnie-msft previously approved these changes Sep 4, 2026
Comment thread eng/pipelines/pr.yml Resolved
@eerhardt
eerhardt dismissed stale reviews from donnie-msft and Nigusu-Allehu via 1a251f3 September 4, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PRs created by someone not in the NuGet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants