.NET Native AOT Runtime Crash: Reflection Type Stripped by IL Trimmer
Dynamic JSON serialization or reflection failed under `<PublishAot>true</PublishAot>`.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: .NET Native AOT Runtime Crash
Platform: DotNet
Common Root Causes:
- Dynamic JSON serialization or reflection failed under `<PublishAot>true</PublishAot>`.
Interactive Diagnostic Checklist
Verified Solutions:
- Use `System.Text.Json` source generators (`JsonSerializerContext`) instead of reflection.
Safe Diagnostic Command:
dotnet publish -r linux-arm64 (inspect IL2xxx/IL3xxx warnings)
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
Dynamic JSON serialization or reflection failed under `<PublishAot>true</PublishAot>`. Recommended diagnostic: `dotnet publish -r linux-arm64 (inspect IL2xxx/IL3xxx warnings)`. Remediation: Use `System.Text.Json` source generators (`JsonSerializerContext`) instead of reflection.
Worked Examples
- Run `dotnet publish -r linux-arm64 (inspect IL2xxx/IL3xxx warnings)` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-dotnet-native-aot-trim-warning · Independently verified: 2026-11-25