From cc6a89debbebeb543d5d038c8ece8acdd491aef8 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Wed, 8 Nov 2023 11:37:24 +0800 Subject: [PATCH] Update asp0022.md (#30969) * Update asp0022.md * Update aspnetcore/diagnostics/asp0022.md Co-authored-by: Tom Dykstra --------- Co-authored-by: Tom Dykstra --- aspnetcore/diagnostics/asp0022.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aspnetcore/diagnostics/asp0022.md b/aspnetcore/diagnostics/asp0022.md index 10e4ec95fd..4c9feddb96 100644 --- a/aspnetcore/diagnostics/asp0022.md +++ b/aspnetcore/diagnostics/asp0022.md @@ -4,7 +4,7 @@ description: "Learn about analysis rule ASP0022: Route conflict detected between author: tdykstra monikerRange: '>= aspnetcore-8.0' ms.author: tdykstra -ms.date: 03/24/2023 +ms.date: 11/08/2023 uid: diagnostics/asp0022 --- # ASP0022: Route conflict detected between route handlers @@ -34,3 +34,9 @@ Do not suppress a warning from this rule. ## Notes [ASP0023](xref:diagnostics/asp0023) warns on route conflicts in ASP.NET Core MVC apps, this analyzer warns on route conflicts in [minimal API](xref:fundamentals/apis) apps. + +This analyzer is intentionally conservative about duplicate routes it reports to avoid false positives: + +* The analyzer only reports duplicate routes declared in the same code block in a method. Duplicate routes in different branches of an `if` statement aren't reported because the analyzer can't statically determine which will be used at runtime. +* The analyzer only reports duplicate routes with known metadata. Unknown methods called on a route handler might add new metadata that is then used to customize how the route is matched. +