diff --git a/src/Http/Routing/src/Builder/RouteHandlerServices.cs b/src/Http/Routing/src/Builder/RouteHandlerServices.cs
index 0a11fd782172..ba3316ddbef1 100644
--- a/src/Http/Routing/src/Builder/RouteHandlerServices.cs
+++ b/src/Http/Routing/src/Builder/RouteHandlerServices.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
@@ -32,7 +33,7 @@ public static class RouteHandlerServices
/// The >.
public static RouteHandlerBuilder Map(
IEndpointRouteBuilder endpoints,
- string pattern,
+ [StringSyntax("Route")] string pattern,
Delegate handler,
IEnumerable? httpMethods,
Func populateMetadata,
@@ -62,7 +63,7 @@ public static RouteHandlerBuilder Map(
/// The >.
public static RouteHandlerBuilder Map(
IEndpointRouteBuilder endpoints,
- string pattern,
+ [StringSyntax("Route")] string pattern,
Delegate handler,
IEnumerable? httpMethods,
Func populateMetadata,