Skip to content

Blazor @page directive remove requirement for string double quotes (RZ1016) #44352

@wstaelens

Description

@wstaelens

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

In Blazor server the @page only accepts a string with double quotes.

We can't use @page MyRoutes.ModuleA or @page $"{MyRoutes.Base}\{MyRoutes.ModuleB}"

Expected Behavior

Should be possible to use const string routes defined in a static class:

@page MyRoutes.ModuleA`
@page $"{MyRoutes.Base}\{MyRoutes.ModuleB}"

Steps To Reproduce

@page RouteHelper.Foo

internal static class RouteHelper {
public const string Foo = "foo/bar";
}

Exceptions (if any)

RZ1016 The 'page' directive expects a string surrounded by double quotes.

.NET Version

6.0.401

Anything else?

Blazor Server
Visual Studio 2022

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions