aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg005.md
| Value | |
|---|---|
| Rule ID | RDG005 |
| Fix is breaking or non-breaking | Non-breaking |
This diagnostic is emitted by the Request Delegate Generator when an endpoint contains a route handler with a parameter annotated with the [AsParameters] attribute that is an abstract type.
The implementation of surrogate binding via the [AsParameters] attribute in Minimal APIs only supports types with concrete implementations. Using a parameter with an abstract type as in the following sample produces the diagnostic.
:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg5/Program.cs" id="snippet_1" highlight="13, 17-21"::: Id, string Task);
Use a concrete type for the surrogate:
:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg5/Program.cs" id="snippet_1f" highlight="14,18-22":::
This warning should not be suppressed. Suppressing the warning will lead to a runtime exception assocaited with the same warning.