dotnet / dotnet/roslyn

Control flow directives (@if, @foreach) allowed inside @code block

Open
#85,652 0 comments 0 reactions 0 assignees View on GitHub
Area-Language Design Area-Razor Area-Razor-Compiler
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Razor currently allows Razor control flow directives like ` @if ` and `@foreach` inside the `@code` block of a component.

Image

This behaviour should probably be either be disallowed, or produce a dianostic warning/error because it blurs the distinction between Razor syntax and C#.

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by reproducing the behavior in a Razor component and determine whether the intended resolution is to reject the directives or emit a diagnostic; done requires that behavior and its expected diagnostic or error be specified and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.