diff --git a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg012.md b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg012.md index c67e1fbdd8..95bb9b334d 100644 --- a/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg012.md +++ b/aspnetcore/fundamentals/aot/request-delegate-generator/diagnostics/rdg012.md @@ -20,32 +20,18 @@ This diagnostic is emitted by the Request Delegate Generator when an endpoint co ### Rule description -The Request Delegate Generator only supports +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. -```csharp -var app = WebApplication.Create(); +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg12/Program.cs" id="snippet_1" highlight="9-20, 22"::: -app.MapPost("/vl/todos", (Todo todo) - => Results.Created(todo)); - -app.Run(); - -private record Todo(int Id, string Task); -``` ## How to fix violations When applicable, set the target parameter type with a friendly accessibility. -```csharp -var app = WebApplication.Create(); -app.MapPost("/vl/todos", (Todo todo) - => Results.Created(todo)); +:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg12/Program.cs" id="snippet_1f" highlight="9-20, 22"::: -app.Run(); - -public record Todo(int Id, string Task); -``` ## When to suppress warnings