ASP0018: Unused route parameter
Value | |
---|---|
Rule ID | ASP0018 |
Category | Usage |
Fix is breaking or non-breaking | Non-breaking |
Cause
A route parameter is specified but not used.
Rule description
A route parameter is specified but not used. In the example below, the id
parameter is defined in the route but not in the route handler.
var app = WebApplication.Create();
app.MapGet("/{id}", () => ...);
How to fix violations
To fix a violation of this rule, remove the route parameter or add code that uses the parameter.
var app = WebApplication.Create();
app.MapGet("/{id}", (string id) => ...);
When to suppress warnings
In general, do not suppress a warning from this rule without validating the route parameter is used. Currently properties within the bound model for FromRoute attributes may not be analyzed. For more information, see GitHub issue #54212
.
Vertu í samstarfi við okkur á GitHub
Heimildina fyrir þetta efni er að finna á GitHub, þar sem þú getur líka búið til og farið yfir vandamál og sameinað beiðnir. Frekari upplýsingar er að finna í framlagshandbók okkar.
ASP.NET Core