aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg006.md
| Value | |
|---|---|
| Rule ID | RDG006 |
| 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 contains an invalid constructor.
Types that are used for surrogate binding via the [AsParameters] attribute must contain a public parameterized constructor where all parameters to the constructor match the public properties declared on the type. The TodoRequest type produces this diagnostic because there is no matching constructor parameter for the Todo property.
:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg6/Program.cs" id="snippet_1" highlight="14,18-22":::
Ensure that all properties on the type have a matching parameter on the constructor.
:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg6/Program.cs" id="snippet_1f" highlight="14,18-22":::
This warning should not be suppressed. Suppressing the warning leads to a runtime exception associated with the same warning.