dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
34.59k stars 9.79k forks source link

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

Open OldrichDlouhy opened 2 weeks ago

OldrichDlouhy commented 2 weeks ago

Is there an existing issue for this?

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:

    [FormatFilter]
    [HttpGet("items.{format}")]
    public async Task<List<ItemDto>> ExportItems()
    {
       ...
    }

.NET Version

.NET 8

Anything else?

May be related to #54212