diff --git a/src/Components/Components/src/RouteAttribute.cs b/src/Components/Components/src/RouteAttribute.cs
index 58d3c2500dc9..b258ed7ae1b5 100644
--- a/src/Components/Components/src/RouteAttribute.cs
+++ b/src/Components/Components/src/RouteAttribute.cs
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
+
namespace Microsoft.AspNetCore.Components;
///
@@ -13,7 +15,7 @@ public sealed class RouteAttribute : Attribute
/// Constructs an instance of .
///
/// The route template.
- public RouteAttribute(string template)
+ public RouteAttribute([StringSyntax("Route")] string template)
{
ArgumentNullException.ThrowIfNull(template);