Skip to content

Razer escape @@ results in build error since SDK 8.0.400 #42730

@ronymeyer

Description

@ronymeyer

Describe the bug

Since preview of 8.0.400 and now also in final version of 8.0.400 compilation of razor pages containing @@ fail with:

FileName.cshtml: error CS9008: Sequence of '@' characters is not allowed. A verbatim string or identifier can only have one '@' character and a raw string cannot have any.

To Reproduce

Any Razor page with code like this fails:
@{ var validationMessage = @Html.ValidationMessage(Model.Binding, "", new { @@class = "invalid-feedback" }, "div"); }

Changing from @@Class to @Class makes the dotNet compilation work, but then the Razor compilation fails with:
Error RZ1007: "class" is a reserved word and cannot be used in implicit expressions. An explicit expression ("@()") must be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-AspNetCoreRazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDKuntriagedRequest triage from a team member

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions