Skip to content

EventCallback.Equals is not giving correct results #53361

Closed
@JelleHissink

Description

@JelleHissink

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

We noticed after upgrading our blazor application to .net 8.0 that some EventCallback keep being modified. Eventhough the value was the same, the same target component, the same method.
The generated code that renders the component seems to fabricate a new MulticastDelegate, having the same Type, Target and Method. The implementation of EventCallback uses Object.ReferenceEquals, so it concludes it is different every render.

Expected Behavior

The component should see EventCallbacks as equal when the delegate and Target are the same. MulticastDelegate has the Equals method overridden, so use that instead of ReferenceEquals.

Steps To Reproduce

I will make a PR with a fix

Exceptions (if any)

No response

.NET Version

8.0.101

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pillar: Technical DebtPriority:2Work that is important, but not critical for the releasearea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions