This is VB.NET.
Does anyone have any idea what might cause the expression mentioned in the title to return False?
Things I am certain of:
- There are keys in the dictionary.
The equality comparer returns a different hashcode for each key and that hashcode is always the same for the same input.- Comparing someDictionary.Keys.First to a newly constructed object equivalent to the key returns True.
- someDictionary.Comparer.Equals(someDictionary.Keys.First, newObjectThatIsEquivalentToFirstKey) returns True.
While someDictionary.Keys.First.GetHashCode always returns the same value (even across multiple program executions), calling GetHashCode on repeatedly recreated equivalent objects does not. The object in question is essentially just a 4-tuple of bools and the hashcode is New BitArray(New Boolean{} (obj.First, obj.Second, obj.Third, obj.Fourth}).GetHashCode- UPDATE: Only one thread.
Update: Apparently, that hash code implementation does NOT always return the same value. I will attempt to diagnose if this is the problem.