dotnet / dotnet/roslyn

[Blazor] Semi-colon inside @() raises syntax errors

Open
#85,548 3 comments 0 reactions 1 assignee Claimed by @chsienki View on GitHub
Area-Razor Area-Razor-Compiler
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Inside a razor page:
```razor

foo


```
This works as expected.

```razor

bar


```
This raises CS0116 and CS0115 errors.
I don't know if this is intended behaviour, but the errors thrown aren't very indicative of the error at hand.

### Expected Behavior

Not entirely sure, either a better error message or for it to compile properly.

### Steps To Reproduce

See description above.

### Exceptions (if any)

CS0115, CS0116

### .NET Version

8.0.302

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.