Hi,
is there a reason why when pre-computing hashCode in Identity, otherTypes parameter is included but when comparing to other in Equals, it is not included?
https://github.com/StackExchange/Dapper/blob/master/Dapper/SqlMapper.Identity.cs
AFAIK, when two object equal, they should have the same hashcode, but if two identity objects were created with different otherTypes parameter, they won't.
We are occasionally seeing a production exception coming from multimap caused by an incorrect type cast. We think it might be caused by the same sql query used in MultiMap with different generic parameters where a deserializer cached for type X is returned for a different type Y. But we can't reproduce it reliably though.
Update: we linked our project to dapper source code for another round of debugging and now we are pretty sure our issue is caused by the Equals/GetHashCode inconsistency.
I'd agree that looks like a bug. Thanks, we'll get that fixed.
Most helpful comment
I'd agree that looks like a bug. Thanks, we'll get that fixed.