-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed as not planned
Closed as not planned
Copy link
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-razor.language
Milestone
Description
Describe the bug
Trying to use EventCallback in an "inline" razor RenderFragment results in a compilation failure. I think this is due to the generated razor cs code calling the wrong AddAttribute override on the builder.
To Reproduce
public class C : ComponentBase
{
[Parameter] public EventCallback E { get; set; }
}@code{
private RenderFragment M() {
return @<C E=@(() => { }) />;
}
}
Expected Behavior
Compiles successfully
Actual Behavior
error CS1503: Argument 2: cannot convert from 'bool' to 'Microsoft.AspNetCore.Components.EventCallback'
Further technical details
- ASP.NET Core version: 5.0.104
Use Case:
Using bUnit to write test cases in .razor files. See: https://bunit.dev/docs/getting-started/writing-tests.html?tabs=xunit#secret-sauce-of-razor-files-tests
This issue was reported in down in the middle of an unrelated thread, but I think it was overlooked, as it wasn't really the main issue: #19640 (comment)
Dreamescaper, davidmilligan, MarisGarrett19 and vgallegob
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-razor.language