Open Joe-Lonsdale opened 3 months ago
@Joe-Lonsdale thanks for contacting us.
That's by design. @()
only accepts expressions, which means you can't use the semi-colon to add statements. If you need to emit a block of code, you can use @{}
, assign a variable and then use the variable within @()
(or @variable
directly)
Behavior is intended but agree we should have a razor error here if possible.
Is there an existing issue for this?
Describe the bug
Inside a razor page:
This works as expected.
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