M
Marcel Müller
I have an index provider (part of a query provider) that has an internal
data structure of type
HashSet<KeyValuePair<Nullable<some_struct>, another_struct>>
some_struct and another_struct are generic. some_struct is typically
something like DateTime? or DateRange? while another_struct is always an
object id (primary key) typed to the entity type where the index belongs to.
The key in KeyValuePair cane become null (i.e. HasValue == false) in
case the property has no value assigned. (This is a well defined part of
the data model.) In this case GetHashCode always seems to return
1188265464 regardless of the value. This ends up in excessive hash
collisions.
I tried to figure out what is going on, but the trace ended at
public override extern int ValueType.GetHashCode();
Something strange seem to happen here that causes many struct instances
that do not compare equal all get the same hash code.
Marcel
data structure of type
HashSet<KeyValuePair<Nullable<some_struct>, another_struct>>
some_struct and another_struct are generic. some_struct is typically
something like DateTime? or DateRange? while another_struct is always an
object id (primary key) typed to the entity type where the index belongs to.
The key in KeyValuePair cane become null (i.e. HasValue == false) in
case the property has no value assigned. (This is a well defined part of
the data model.) In this case GetHashCode always seems to return
1188265464 regardless of the value. This ends up in excessive hash
collisions.
I tried to figure out what is going on, but the trace ended at
public override extern int ValueType.GetHashCode();
Something strange seem to happen here that causes many struct instances
that do not compare equal all get the same hash code.
Marcel