dotnet / dotnet/roslyn

Consecutive @(...) not allowed inside html attribute

Open
#85,604 2 comments 0 reactions 0 assignees 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?

- [ ] I have searched the existing issues

I tried searching for this error, but I'm unaware of the name of this language construct. Searching with just the symbols didn't yield any results for me.

### Describe the bug

I'm building a dynamic url in a Blazor component and was debugging compilation failures. Simplified, the bug reproduces on this example:

```razor

```

### Expected Behavior

I would expect this to work, as these variants are also supported:

```razor


@("")@("")
```

### Steps To Reproduce

- Apply the Blazor template
- Replace `Home.razor` with:
```razor
@page "/"


```

### Exceptions (if any)

```
0>Home.razor(3,14): Error CS1003 : Syntax error, ',' expected
0>Components_Pages_Home_razor.g.cs(92,23): Error CS1501 : No overload for method 'AddAttribute' takes 4 arguments
```

### .NET Version

9.0.100 and 10.0.100-preview.3.25201.16

### Anything else?

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.