You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have dictionaries where the key has custom equality and hashcode (actually they are automatic via record but the issue is the same)
When verifying the order of the keys sometimes swaps. I have been unable to work out why when the input object to verify is the same as some rusn are the expected way around and others are not.
The resulting comparison is non-deterministic resulting in flaky tests.
Note that we are actually using json and immutable dictionaries, but I can see the issue with a simple repro using a plain dictionary.
Minimal Repro
I can see that that the existing test DictionaryOrderNonComparable is only validating when created alphabetically.
Not sure if multiple runs are required as it always happens when I run an equivalent locally, but our full object tests it is flaky and sometimes does pass with no code changes.
Describe the bug
We have dictionaries where the key has custom equality and hashcode (actually they are automatic via
record
but the issue is the same)When verifying the order of the keys sometimes swaps. I have been unable to work out why when the input object to verify is the same as some rusn are the expected way around and others are not.
The resulting comparison is non-deterministic resulting in flaky tests.
Note that we are actually using json and immutable dictionaries, but I can see the issue with a simple repro using a plain dictionary.
Minimal Repro
I can see that that the existing test DictionaryOrderNonComparable is only validating when created alphabetically.
To recreate update the DictionaryOrderNonComparable test to provide
Foo2
beforeFoo1
.Not sure if multiple runs are required as it always happens when I run an equivalent locally, but our full object tests it is flaky and sometimes does pass with no code changes.
Verified:
Received:
The text was updated successfully, but these errors were encountered: