Skip to content

[AOT] Unit testing features with Native AOT #45860

Open
@JamesNK

Description

@JamesNK

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 [AOT] Add middleware reflection fallback #45890
  • PopulateMetadata fallback

https://github.com/dotnet/runtime has a pattern for this type of testing. We should look at what runtime do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NativeAOTarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionslinker-friendlinessTracking linker friendliness

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions