AspNetCore.Docs/aspnetcore/diagnostics/asp0018.md

891 B

title description author monikerRange ms.author ms.date uid
ASP0018: Unused route parameter Learn about analysis rule ASP0018: Unused route parameter tdykstra >= aspnetcore-8.0 tdykstra 11/22/2022 diagnostics/asp0018

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 name 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.

When to suppress warnings

Do not suppress a warning from this rule.