"Binary operator Equal is not defined" on custom struct types used as keys #21372
Labels
area-change-tracking
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
(As mentioned in this comment on an older, closed issue #12290, I have moved to create an issue for my specific problem.)
When attempting to use a custom struct with a defined value conversion to and from
ulong
as a key, performing aFindAsync()
query will generate an exception:I am not sure if this is a regression from issue #12290 which was supposedly fixed, or a completely separate issue altogether. If needed, I am happy to test this on non-super-unstable-and-new versions of EF Core. This just happened to be the version I was using.
Steps to reproduce
*Note: This Snowflake struct is a simplified version of this struct from a library I am using. If you believe the full struct would assist in any way for finding a solution you are welcome to use this instead for triage or testing.
Below is a full one-file example project I created to test this. The code does not perform any migrations or raw database operations so for testing, migrations will need to be created and applied to the testing database.
Assuming everything is set up correctly, when
Main()
is called, it should enter the catch section and complain about theGuild
not being found, and printing a similar if not identical exception message to console.Further technical details
EF Core version:
5.0.0-preview.5.20278.2
Database provider:
Npgsql.EntityFrameworkCore.PostgreSQL
, version5.0.0-preview5
Target framework: .NET 5.0 preview (
5.0.100-preview.4.20258.7
)Operating system: Windows 10 x64
IDE: Visual Studio 2019 16.7.0 Preview 2.0
The text was updated successfully, but these errors were encountered: