Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task
Bouke opened this issue May 22, 2025 · 2 comments
Open
1 task

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

Bouke opened this issue May 22, 2025 · 2 comments
Labels
area-blazor area-compiler Umbrella for all compiler issues
Milestone

Comments

@Bouke
Copy link

Bouke commented May 22, 2025

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:

<a href="@("")@("")"></a>

Expected Behavior

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

<a href="@("") @("")"></a>
<a href="@("")"></a>
<a>@("")@("")</a>

Steps To Reproduce

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

<a href="@("")"></a>

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?

@javiercn javiercn transferred this issue from dotnet/aspnetcore May 22, 2025
@davidwengier davidwengier added the area-compiler Umbrella for all compiler issues label May 22, 2025
@davidwengier
Copy link
Member

davidwengier commented May 22, 2025

As per #9985 (comment) I believe this behaviour is by design in the compiler.

@chsienki chsienki added this to the Backlog milestone May 22, 2025
@chsienki
Copy link
Member

Yes, unfortunately this behavior is currently 'by design' in that it would be a breaking change to fix it. We have considered options for how to move forward with these kinds of changes though, so will leave this open to track it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor area-compiler Umbrella for all compiler issues
Projects
None yet
Development

No branches or pull requests

3 participants