Razor components: Calling method with optional argument from event - "Error CS1503: Argument 2: cannot convert from 'method group' to 'EventCallback'"
See original GitHub issueI have a function in my component like this:
private async Task LoadConferencesAsync(SearchFilter filter = null)
When I try to call it from an e.g. onclick event like this
<MudIcon Icon="@Icons.Material.Filled.Refresh" @onclick="LoadConferencesAsync" />
I get this error:
TTConfTool.UI/Conferences/Conferences.razor(66,66): Error CS1503: Argument 2: cannot convert from 'method group' to 'EventCallback' (CS1503) (TTConfTool.UI)

Should it be possible to call methods with optional parameters?
Thanks!
.NET SDK (reflecting any global.json): Version: 6.0.100-preview.1.21103.13 Commit: b8a03527b2
Runtime Environment: OS Name: Mac OS X OS Version: 11.2 OS Platform: Darwin RID: osx.11.0-x64 Base Path: /usr/local/share/dotnet/sdk/6.0.100-preview.1.21103.13/
Host (useful for support): Version: 6.0.0-preview.1.21102.12 Commit: 9b2776d481
I am using Visual Studio Enterprise 2019 for Mac (Preview) Version 8.10 Preview (8.10 build 409)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)

Top Related StackOverflow Question
Thanks for contacting us. I’ve validated this and indeed having a method with an optional parameter will fail. You can, for now use an alternative syntax to workaround this:
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.