Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Using expr switch { <0 => something }
statement with ranges inside @code{}
does not compile. the <
character in switch apparently confuses tokenizer. using regular switch expr { case <0: return something; }
works.
Expected Behavior
I'd expect the page to compile
Steps To Reproduce
@page "/test"
@Sign(1)
@code
{
private static int Sign(int number)
{
return number switch
{
< 0 => -1,
0 => 0,
> 0 => +1
};
}
}
Exceptions (if any)
Test.razor(5,1,5,2): error RZ1006: The code block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
Test.razor(6,1,6,2): error RZ1006: The code block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
Test.razor(11,13,11,19): error RZ9980: Unclosed tag '' with no matching end tag.
Test.razor(11,14,11,14): error RZ1025: The "" element was not closed. All elements must be either self-closing or have a matching end tag.
Test.razor(7,5,7,12): error CS0106: The modifier 'private' is not valid for this item
.NET Version
7.0.200
Anything else?
ASP.NET Core version: 7.0.3