Razor compiler error with legit syntax for inline helper method #7652
Open
Description
The following .razor
file compiles and works fine:
@using Microsoft.AspNetCore.Components.Rendering
@code{
void MyFragment(RenderTreeBuilder __builder)
{
<input @oninput="OnInput" />
}
void OnInput()
{
}
}
... whereas the following code gives a compiler error:
@using Microsoft.AspNetCore.Components.Rendering
@code{
void MyFragment(RenderTreeBuilder __builder)
{
<input @oninput="@OnInput" />
}
void OnInput()
{
}
}
Notice that the only difference between these two is the @
in ...="@OnInput"
. This should not make any difference. The error is:
Counter.razor(6,27,6,34): error CS1503: Argument 3: cannot convert from 'method group' to 'bool'
Weirdly this error only appears in the compiler output and does not appear in the VS Errors pane. This was first reported at dotnet/aspnetcore#26729 (comment).
Activity