fix RDG9 /8 (#30906)

* fix RDG9 /8

* fix RDG9 /8

* fix RDG9 /8

* fix RDG9 /8

* fix RDG9 /8

* fix RDG9 /8

* fix RDG9 /8
pull/30910/head
Rick Anderson 2023-11-01 15:59:49 -10:00 committed by GitHub
parent ab2043e5dc
commit 62edb4c251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 18 deletions

View File

@ -4,7 +4,7 @@ description: "Learn about analysis rule RDG009: Invalid nested AsParameters"
author: captainsafia
monikerRange: '>= aspnetcore-8.0'
ms.author: safia
ms.date: 9/15/2023
ms.date: 11/1/2023
uid: fundamentals/aot/request-delegate-generator/diagnostics/rdg009
---
# RDG009: Invalid nested AsParameters
@ -20,27 +20,15 @@ This diagnostic is emitted by the [Request Delegate Generator](/aspnet/core/fund
### Rule description
Types that are used for surrogate binding via the [`[AsParameters]`](xref:Microsoft.AspNetCore.Http.AsParametersAttribute) attribute must not contain nested types that are also annotated with the [`[AsParameters]`](xref:Microsoft.AspNetCore.Http.AsParametersAttribute) attribute.
Types that are used for surrogate binding via the [`[AsParameters]`](xref:Microsoft.AspNetCore.Http.AsParametersAttribute) attribute must not contain nested types that are also annotated with the [`[AsParameters]`](xref:Microsoft.AspNetCore.Http.AsParametersAttribute) attribute:
<!--
```razor
var app = WebApplication.Create();
var version = "v1";
var route = $"/{version}/todos";
app.MapGet("/vl/todos", () => Results.Ok([new Todo(1, "Write tests"), new Todo(2, "Fix tests")]));
app.Run();
record Todo(int Id, string Task);
```
-->
:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg9/Program.cs" id="snippet_1f" highlight="19,31":::
## How to fix violations
Remove the nested nested `AsParameters` attribute.
Remove the nested nested `AsParameters` attribute:
:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/aot/diagnostics/Rdg9/Program.cs" id="snippet_1" highlight="17,29":::
## When to suppress warnings

View File

@ -245,6 +245,8 @@ items:
uid: fundamentals/aot/request-delegate-generator/diagnostics/rdg007
- name: RDG008
uid: fundamentals/aot/request-delegate-generator/diagnostics/rdg008
- name: RDG009
uid: fundamentals/aot/request-delegate-generator/diagnostics/rdg009
- name: RDG010
uid: fundamentals/aot/request-delegate-generator/diagnostics/rdg010
- name: RDG011