dotnet / dotnet/aspnetcore

ASP0018 analyzer does not respect FormatFilterAttribute for {format} route parameter

Open
#55,702 0 comments 1 reaction 0 assignees View on GitHub
analyzer area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

When route uses parameter `{format}` and the method is marked with `FormatFilterAttribute`, the ASP0018 analyzer claims a parameter is unused.

### Expected Behavior

The ASP0018 analyzer should not generate the warning

### Steps To Reproduce

Having method like this in controller:

```CSharp
[FormatFilter]
[HttpGet("items.{format}")]
public async Task> ExportItems()
{
...
}
```

### .NET Version

.NET 8

### Anything else?

May be related to #54212

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.