.NET 10 ships measurable reductions in Native AOT binary size and startup time for Minimal API projects. The runtime trims more aggressively while preserving reflection-free endpoint registration introduced in earlier releases.

Teams running containerized services see the largest benefit. Cold-start latency drops below 50 ms on modest hardware, and working set memory falls by roughly 30 percent compared with the .NET 9 baseline.

#Key compiler and runtime changes

  • Improved trimming of System.Text.Json metadata for record types used in endpoint parameters.
  • Static analysis now recognizes more delegate-based route handlers, eliminating manual [DynamicDependency] attributes.
  • Reduced JIT fallback paths for common HTTP pipeline components.

#Publishing command for production

bash
dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishAot=true -p:PublishTrimmed=true

#Endpoint example that stays trim-friendly

csharp
var builder = WebApplication.CreateSlimBuilder(args);
builder.Services.ConfigureHttpJsonOptions(o =>
    o.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default));

var app = builder.Build();
app.MapGet("/orders/{id}", (int id, OrderService svc) => svc.Get(id));
app.Run();

No additional attributes are required on the handler when the JSON context is registered at build time.

#Deployment checklist

  • Verify all dependencies support trimming; replace any that rely on runtime reflection.
  • Run the app with DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 in containers to drop ICU data.
  • Measure startup with dotnet trace before and after the AOT switch.

Enable Native AOT on new Minimal API projects today. The only required change is the PublishAot MSBuild property; the resulting image is smaller, starts faster, and consumes less memory under load.