Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Summary of the changes

Error RZ9979 displayed '@{{ {0} }}' and {{... }} with spaces around placeholders, suggesting incorrect syntax to users. Changed to '@{{{0}}}' and {{...}} without spaces.

  • Updated error message in ComponentDiagnosticFactory.cs: '@{{ {0} }}''@{{{0}}}' and {{... }}{{...}}
  • Reverted previous incorrect changes to RZ1029 (Resources.resx and 8 test baseline files)
Original prompt

This section details on the original issue you should resolve

<issue_title>Confused by error message regarding attribute syntax</issue_title>
<issue_description>I’ve just started to play around with Blazor and tried to write this code in a .razor-file:

<span class="@if(sortType != 0) { <text>btn-primary</text> } else { <text>btn-success</text> }">

Yes, not very elegant :-) Either way, I got this error message that confuses me:

Code blocks delimited by '@{...}' like '@{ if(sortType != 0) { } }' for attributes are no longer supported These features have been changed to use attribute syntax. Use 'attr="@(x => {... }"'.

I’ve tried to rewrite me code to use lambda expression as suggested, but whatever I do a get an error message. Is this possible in this case? I’ve noticed that a lambda expression works fine if the attribute is @onclick.

If I rewrite my code like this it works, but that is not was the error message suggest:

<span class="btn @(sortType != 0 ? "btn-primary" : "btn-success")">

</issue_description>

Comments on the Issue (you are @copilot in this section)

@ We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our [Triage Process](https://github.com/dotnet/aspnetcore/blob/master/docs/TriageProcess.md). @ We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our [Triage Process](https://github.com/dotnet/aspnetcore/blob/main/docs/TriageProcess.md).

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Remove spaces around {key} placeholder in error message RZ1029 for better clarity.

The error message now shows:
<input int-prefix-{key}="value">

Instead of the confusing:
<input int-prefix-{ key }="value">

Updated both the Resources.resx file and all test baselines.

Co-authored-by: dbreshears <[email protected]>
Copilot AI changed the title [WIP] Fix confusing error message regarding attribute syntax Fix confusing syntax in RZ1029 error message for dictionary attribute keys Jan 16, 2026
Copilot AI requested a review from dbreshears January 16, 2026 00:01
@dbreshears dbreshears requested a review from chsienki January 16, 2026 00:40
@dbreshears dbreshears assigned chsienki and unassigned dbreshears Jan 16, 2026
@chsienki
Copy link
Member

@copilot This is the incorrect message to change. Undo the previous work. The message you need to change is RZ9979

Reverted previous changes to RZ1029 and instead fixed RZ9979 as requested.
Changed '@{{ {0} }}' to '@{{{0}}}' and '{{... }}' to '{{...}}' to remove confusing spaces.

Co-authored-by: chsienki <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jan 16, 2026

@copilot This is the incorrect message to change. Undo the previous work. The message you need to change is RZ9979

Reverted the changes to RZ1029 and fixed RZ9979 instead. Changed '@{{ {0} }}' to '@{{{0}}}' and '{{... }}' to '{{...}}' in ComponentDiagnosticFactory.cs (commit 5a8668b).

Copilot AI changed the title Fix confusing syntax in RZ1029 error message for dictionary attribute keys Fix confusing syntax in RZ9979 error message for code blocks in attributes Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confused by error message regarding attribute syntax

3 participants