Skip to content

Blazor extra parenthesis make silent error and weird behavior on input checked. #7649

@Bartmax

Description

@Bartmax

Describe the bug

Found a strange behavior. If I have an extra ) on an input type radio checked attribute there's no compile nor runtime error, almost work but UI (selected label) got out of sync.
Removing the extra ) work flawlessly.

<input name="arch" type="radio"
               value="@item"
               checked="@IsActive(item))" <!-- NOTE THE EXTRA `)` -->
               @onchange="@( _ => ChangeArchitecture(item))" />

Any other character I tried will raise a compile time error.

To Reproduce

Since I have a hard time explaining it I made a repo available that shows the error.
It's a new wasm project with only the index.razor modified: https://github.com/Bartmax/BlazorAppIssue/blob/master/Pages/Index.razor

also here's a gif showing the error in action
ezgif com-video-to-gif (2)

Exceptions (if any)

No error shown neither on compile time or runtime.

Further technical details

Details dotnet --info .NET Core SDK (reflecting any global.json): Version: 3.1.301 Commit: 7feb845744

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.301\

Host (useful for support):
Version: 3.1.5
Commit: 65cd789777

.NET Core SDKs installed:
3.1.301 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions