Skip to content

Blazor: EditContext fieldstate tracking falls apart when model implements GetHashCode #18069

@ghost

Description

Describe the bug

When a model implements GetHashCode, the _fieldState dictionary within EditContext continually adds to it's collection for the same field, effectively breaking the field-state logic.

To Reproduce

In my case, I used a protocol buffer to generate a simple C# class. Here's a gist: https://gist.github.com/aaronhudon-ts/6f9b079014115f539feef9b599a2c14d

  • Put a breakpoint in EditContext.cs GetFieldState. Start changing values in fields. You will notice that the call to TryGetValue always fails due to the underlying GetHashCode call of the FieldIdentifier.

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions