[AOT] Unit testing features with Native AOT
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
There are places where features use different APIs if the app is published with native AOT. For example, routing uses IL emit to generate custom lookup tables when `IsDynamicCodeSupported` is true, and falls back to dictionary lookup when it is false.
We should have unit tests that execute tests with native AOT to verify these code paths work correctly. Code that tests `IsDynamicCodeSupported` or `IsDynamicCodeCompiled` are likely candidates.
Known places that should have native AOT testing:
- [ ] Building route DFA
- [ ] ProblemDetails + Extensions
- [ ] MapXXX methods + request filters
- [ ] Generic host + value type container builder (verify that error is thrown)
- [ ] Invoke middleware with parameters https://github.com/dotnet/aspnetcore/pull/45890
- [ ] PopulateMetadata fallback
https://github.com/dotnet/runtime has a pattern for this type of testing. We should look at what runtime do.
Contributor guide
Assessment
This issue has not been assessed yet.