From 7117cf1ed0f5ea531ae8d40b928f0bab5034676a Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Mon, 9 Oct 2023 20:42:21 +0200 Subject: [PATCH] add RDG010 example (#30613) --- .../request-delegate-generator/diagnostics/rdg010.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg010.md b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg010.md index 6c3abbc9bb..e994ddcc7c 100644 --- a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg010.md +++ b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg010.md @@ -18,14 +18,20 @@ uid: fundamentals/aot/request-delegate-generator/diagnostics/rdg010 This diagnostic is emitted by the [Request Delegate Generator](/aspnet/core/fundamentals/aot/request-delegate-generator/rdg) when an endpoint contains a route handler with a parameter annotated with the [`[AsParameters]`](xref:Microsoft.AspNetCore.Http.AsParametersAttribute) attribute that contains is nullable. + ### Rule description -The implementation of surrogate binding via the [`[AsParameters]`](xref:Microsoft.AspNetCore.Http.AsParametersAttribute) attribute in minimal APIs only supports types that are not nullable. +The implementation of surrogate binding via the [`[AsParameters]`](xref:Microsoft.AspNetCore.Http.AsParametersAttribute) attribute in minimal APIs only supports types that are not nullable. + +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg10/Program.cs" id="snippet_1" highlight="7"::: ## How to fix violations Declare the parameter as non nullable. +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg10/Program.cs" id="snippet_1f" highlight="7"::: + ## When to suppress warnings -This warning should not be suppressed.. +This warning should ***not*** be suppressed. Suppressing the warning leads to a runtime exception associated with the same warning. +