When defining a MinimalAPI route, S3257 fails to detect that the parameter is used in the route. Therefor is wrongly states that the parameter can be removed.
Obviously, it is strange that nothing is done with a parameter in the route when executing the request, but removing it from the method, breaks the code.
using Microsoft.AspNetCore.Mvc;
namespace Tjip.AspNetCore.ExampleApi.WebFeatures;
internal sealed class MinimalApiHandler
{
/// <inheritdoc />
public void Use(WebApplication app)
{
app.MapGet("some-route/{id}", ([FromRoute] Guid id) => true); // Compliant
}
}
Reported by SonarAnalyzer.CSharp v10.20.0.135146