Eventhandlers not binding as expected: The call is ambiguous between BindMethods.GetEventHandlerValue...
Trying to update the blazor-realworld-example-app on a local fork but having problems updating to the new onclick="@x" binder syntax.
Example:
<a class="nav-link" onclick="@clicktest"> Click test</a>
void clicktest(UIMouseEventArgs e) {
Console.WriteLine("Click testing ");
}
Result:
The call is ambiguous between the following methods or properties: 'BindMethods.GetEventHandlerValue
Note:
A lambda works fine
<a class="nav-link" onclick="@((e)=>clicktest(e))">
Click test
</a>
Refs:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RunCommand>dotnet</RunCommand>
<RunArguments>blazor serve</RunArguments>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommonMark.NET" Version="0.15.1" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.0-preview2-final" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.3.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.3.0" />
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="2.1.0-preview2-final" PrivateAssets="All" />
<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.3.0" />
</ItemGroup>
</Project>
Core SDK: 2.1.300-preview2-008533 Test repo: https://github.com/Psvensso/blazor-realworld-example-app/tree/onclick-snapshot
It works in release version 0.3.0
Upgrading to 0.3.0 on available packages does not resolve it. (Edited issue description)
@Psvensso Your test repo has global.json which refers dotnet core SDK 2.1.300-preview1-008174.
0.3.0 requires 2.1.300-preview2-008533 or later.
@Psvensso you need to configure the project for C# 7.3, add <LangVersion>7.3</LangVersion> to your <PropertyGroup> of your .csproj
@Psvensso See this "Upgrade an existing project to Blazor 0.3.0" section for more detail. https://blogs.msdn.microsoft.com/webdev/2018/05/02/blazor-0-3-0-experimental-release-now-available/
Ah! Almost made it without the blogpost, just need the final refs and BS4 upgrades. Thank you for your time :)