Skip to content

Possible verbatim string literal regression #10568

@SteveSandersonMS

Description

@SteveSandersonMS

Repro code in any .razor file:

@for(var i = 0; i < 3; i++)
{
    var filename = @$"ticket-{i}.png";
    <h1>@filename</h1>
}

This is legal code as far as I know and used to work without errors or warnings. However in Version 17.11.0 Preview 2.0 this shows an error:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error (active)	RZ1009	The "@" character must be followed by a ":", "(", or a C# identifier.  If you intended to switch to markup, use an HTML start tag, for example: ...

On my machine this appears in the VS Error UI but does not occur during command-line compilation (probably a slightly older SDK).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions