EventCallback<TValue> with a Generic Component with multiple Generic Arguments causes an error
Describe the bug
If a Blazor Component has multiple Generic Parameters then EventCallbacks<TValue> cannot be bound without an intermediary class.
To Reproduce
GenericComponent.cs
@typeparam THeader
@typeparam TRow
<h3>GenericComponent</h3>
@code {
[Parameter]
public EventCallback<TRow[]> Callback { get; set; }
[Parameter]
public EventCallback<CustomArgs<TRow>> CallbackWithClass { get; set; }
}
CustomArgs.cs
public class CustomArgs<TValue>
{
public TValue[] Values { get; set; }
}
public class Abc
{
}
public class Def
{
}
TestComponent.cs
<GenericComponent
THeader="Abc"
TRow="Def"
Callback="Callback" <-------------------------- Error
CallbackWithClass="CallbackWithClass"
/>
@code {
public async Task Callback(Def[] value)
{
await Task.CompletedTask;
}
public async Task CallbackWithClass(CustomArgs<Def> args)
{
await Task.CompletedTask;
}
}
Exceptions (if any)
CS1503 Argument 2: cannot convert from 'method group' to 'EventCallback'
Further technical details
- ASP.NET Core version: 5.0.0
- Include the output of
dotnet --infoVersion: 5.0.100 Commit: 5044b93829 - Visual Studio Community 2019 v16.8.2
Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
If fixing this, verify that the scenario described at https://github.com/dotnet/aspnetcore/issues/29871 is fixed too. If not, reopen that issue.
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.
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.
Any updates on this?
Still not working.
It seems that you have to
Callback="async (ConcreteType thing) => await Callback(thing)"
which is rather cumbersome.