native-aot

Installation
SKILL.md

Native AOT, Trimming & Single-File (.NET 10)

Core Principles

  1. Decide early — AOT constrains library choice (no runtime reflection or code generation). Adding it to a mature reflection-heavy app is a rewrite. Adding it on day one costs almost nothing.
  2. A trim/AOT warning is a future runtime crash — IL2xxx (trimming) and IL3xxx (AOT/single-file) warnings mark code that may throw MissingMethodException or silently misbehave in the published binary. Treat them as errors and keep the count at zero.
  3. Source generators replace reflection — JSON, regex, logging, configuration binding, options validation, and MVVM all have generators. They keep the AOT path fast and analyzable.
  4. Test the published artifact, not dotnet run — dotnet run uses the JIT and full metadata, so it hides every trimming bug. Smoke-test the binary that dotnet publish produces, in CI.
  5. AOT is a trade, not a free upgrade — You get fast startup, small memory, and no runtime install. You lose dynamic loading, Reflection.Emit, and some steady-state throughput from Dynamic PGO. Pick it where those trade-offs pay.

Patterns

Project Setup

Installs
40
GitHub Stars
801
First Seen
1 day ago