Skip to content

Docs: trimming and native AOT, with a recipe proven on a trimmed publish - #165

Merged
electricessence merged 2 commits into
masterfrom
feat/a14-trim-aot-readme
Nov 16, 2026
Merged

electricessence merged 2 commits into
masterfrom
feat/a14-trim-aot-readme

Conversation

@electricessence

Copy link
Copy Markdown
Collaborator

What this changes

Documents trimming and native AOT for 11.0. Docs only: no code, props or public API change.

  • Source/Core/README.md (the page nuget.org shows) gets a new "Trimming and native AOT" section: the library is not marked trimmable, native AOT is not supported in 11.0, and the section gives the recipe that makes Map<T>() work in a trimmed app, with the error you get without it.
  • README.md gets one paragraph with an absolute link to that section.

The recipe is proven, not assumed. Five trimmed publishes of a small app on master, each with a different set of roots, run a set of probes (a class, a record, AddParam, AddParams, a NULL into a non-nullable string, an unrooted scalar and a non-query path):

  • No roots: fails first with "'Post' cannot be mapped: it has no public constructor", and the same app untrimmed is fine.
  • All roots: every probe passes.
  • The narrow form shipped in the README (public constructors, properties and fields on the models and parameter types, and public methods on the provider's reader type): every probe passes, with output identical to the untrimmed run.
  • Reader type unrooted: every Map fails ("Value cannot be null. (Parameter 'method')"). Parameter type unrooted: only AddParams fails. The README says why each root is needed.
  • The README snippet is identical to the roots that ran.

What was and was not measured, and what the README says. Measured on net10.0 (win-x64, self-contained) with Microsoft.Data.Sqlite; the README names that. A net11.0 runtime pack was not available offline, and SqlDataReader and native AOT were not run, so the README says so and tells readers to root their provider's reader type. The recipe adds three extra IL2111 trim warnings to a publish (17 against 14 with no roots); the publish and every probe still pass.

Checks

  • The diff is the two READMEs only (git diff --stat); no .cs, .csproj, .props or public API file.
  • The quick check passes (Release build 0 warnings, format clean); DocFX builds with 0 warnings; leak scan clean.

🤖 Generated with Claude Code

electricessence and others added 2 commits November 16, 2026 10:47
…d-publish recipe

Core is not marked trimmable and native AOT is not supported in 11.0. The Core README now says so in one section, names what ODX reads by reflection, quotes the symptoms of a trimmed type, and gives a DynamicDependency recipe. The root README links to it. Trim and AOT annotations are deferred; adding them later only adds a warning for consumers, never a break. The recipe is proven by trimmed publishes of a scratch app (Microsoft.Data.Sqlite, .NET 10, win-x64): without roots Map<T> fails at the first query, with the recipe every probe maps and matches the untrimmed run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… root reports

The measured trimmed publish reports three more ILLink warnings with the recipe's roots than without them (17 against 14); they come from rooting the provider's data reader type, and the publish and every probe still succeed. Say so in the Trimming and native AOT section.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@electricessence
electricessence marked this pull request as ready for review November 16, 2026 20:13
@electricessence
electricessence merged commit 36947db into master Nov 16, 2026
7 checks passed
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.

1 participant