Skip to content

Route conflict between route handlers (ASP0022)

Key dotnet.api.route-handler-conflict · Severity warning · Category api

ASP.NET Core analyzer ASP0022. Flags two minimal-API route handlers mapped to the same route and method. Requests fail with an ambiguous-match error.

app.MapGet("/orders/{id}", (int id) => Find(id));
app.MapGet("/orders/{orderId}", (int orderId) => Load(orderId));
app.MapGet("/orders/{id}", (int id) => Find(id));
app.MapGet("/orders/{orderId}/lines", (int orderId) => Lines(orderId));