Skip to content

Annotate dynamic and trim not compatible code paths - #7462

Merged
Nigusu-Allehu merged 1 commit into
devfrom
dev-nyenework-annotate-nsj
Jun 10, 2026
Merged

Nigusu-Allehu merged 1 commit into
devfrom
dev-nyenework-annotate-nsj

Conversation

@Nigusu-Allehu

@Nigusu-Allehu Nigusu-Allehu commented Jun 8, 2026 •

Copy link
Copy Markdown
Member

Bug

Fixes: NuGet/Home#14934

Description

Add [RequiresUnreferencedCode] and [RequiresDynamicCode] annotations to public Newtonsoft.Json-based serialization/deserialization APIs in NuGet.Protocol.

This marks all public methods that rely on NSJ's reflection-based serialization as trim/AOT-unsafe, so consumers get compile-time warnings when calling them in trimmed or AOT-compiled applications. Internal callers within NuGet.Protocol suppress the warnings at their call sites since they're legacy code paths gated behind the STJ feature switch.

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.

@Nigusu-Allehu
Nigusu-Allehu requested a review from a team as a code owner June 8, 2026 20:37
@Nigusu-Allehu
Nigusu-Allehu requested review from jeffkl and nkolev92 June 8, 2026 20:37
@Nigusu-Allehu Nigusu-Allehu self-assigned this Jun 8, 2026
@Nigusu-Allehu

Nigusu-Allehu commented Jun 8, 2026 •

Copy link
Copy Markdown
Member Author

The failed build will be fixed in #7458. I will rebase. It is the annotations working and failing in places where we use these annotated methods.

@Nigusu-Allehu
Nigusu-Allehu force-pushed the dev-nyenework-annotate-nsj branch from 8b8e4ec to 76672e1 Compare June 8, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Annotate Newtonsoft.Json deserialization code path

3 participants