From 348ae2f16baf10916f7b902a5bbf0796547a281a Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:13:40 +0200 Subject: [PATCH] fix RDG highlights after code samples update --- .../aot/request-delegate-generator/diagnostics/rdg010.md | 4 ++-- .../aot/request-delegate-generator/diagnostics/rdg011.md | 5 ++--- .../aot/request-delegate-generator/diagnostics/rdg012.md | 4 ++-- .../aot/request-delegate-generator/diagnostics/rdg013.md | 5 +++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg010.md b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg010.md index 014374cab2..d42a574a10 100644 --- a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg010.md +++ b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg010.md @@ -23,13 +23,13 @@ This diagnostic is emitted by the [Request Delegate Generator](/aspnet/core/fund 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"::: +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg10/Program.cs" id="snippet_1" highlight="13"::: ## 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"::: +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg10/Program.cs" id="snippet_1f" highlight="13"::: ## When to suppress warnings diff --git a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg011.md b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg011.md index 396fdc1230..fbb3099401 100644 --- a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg011.md +++ b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg011.md @@ -22,14 +22,13 @@ This diagnostic is emitted by the Request Delegate Generator when an endpoint co Endpoints that use generic type parameters are not supported. The endpoints within `MapEndpoints` produce this diagnostic because of the generic `` parameter. -:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg11/Program.cs" id="snippet_1" highlight="9-20"::: +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg11/Program.cs" id="snippet_1" highlight="16"::: ## How to fix violations Remove the generic type from endpoints. -:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg11/Program.cs" id="snippet_1f" highlight="9-20"::: - +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg11/Program.cs" id="snippet_1f" highlight="16"::: ## When to suppress warnings diff --git a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg012.md b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg012.md index 95bb9b334d..4417afce1f 100644 --- a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg012.md +++ b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg012.md @@ -23,14 +23,14 @@ This diagnostic is emitted by the Request Delegate Generator when an endpoint co Endpoints that use an inaccessible type (`private` or `protected`) are not supported. The endpoints within `MapEndpoints` produce this diagnostic because of the `Todo` type has the `private` accessibility modifiers. -:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg12/Program.cs" id="snippet_1" highlight="9-20, 22"::: +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg12/Program.cs" id="snippet_1" highlight="16-27, 29"::: ## How to fix violations When applicable, set the target parameter type with a friendly accessibility. -:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg12/Program.cs" id="snippet_1f" highlight="9-20, 22"::: +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg12/Program.cs" id="snippet_1f" highlight="17-28, 30"::: ## When to suppress warnings diff --git a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg013.md b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg013.md index 53232b2e8b..2b4d47e95e 100644 --- a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg013.md +++ b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg013.md @@ -22,13 +22,14 @@ This diagnostic is emitted by the [Request Delegate Generator](/aspnet/core/fund ASP.NET Core supports resolving keyed and non-keyed services via [dependency injection](xref:fundamentals/dependency-injection). It's ***not*** feasible to resolve a service as both keyed and non-keyed. The following code produces the diagnostic and throws a run time error with the same message: -:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg13/Program.cs" id="snippet_1" highlight="8"::: +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg13/Program.cs" id="snippet_1" highlight="14"::: ## How to fix violations Resolve the target parameter as either a keyed or non-keyed service. -:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg13/Program.cs" id="snippet_1f" highlight="10,15,20"::: +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg13/Program.cs" id="snippet_1f" highlight="16,21,26"::: + ## When to suppress warnings This warning should ***not*** be suppressed. Suppressing the warning leads to a [NotSupportedException](/dotnet/api/system.notsupportedexception) runtime exception `The FromKeyedServicesAttribute is not supported on parameters that are also annotated with IFromServiceMetadata.`