Description
Some ValueTuples' IStructuralEquatable.Equals methods skip comparing Item4.
|
bool IStructuralEquatable.Equals(object? other, IEqualityComparer comparer) => |
|
other is ValueTuple<T1, T2, T3, T4, T5> vt && |
|
comparer.Equals(Item1, vt.Item1) && |
|
comparer.Equals(Item2, vt.Item2) && |
|
comparer.Equals(Item3, vt.Item3) && |
|
comparer.Equals(Item5, vt.Item5); |
Search vt.Item3) && in that file to find more.
Reproduction Steps
using System.Collections;
IStructuralEquatable a = ValueTuple.Create(1, 2, 3, 4, 5);
IStructuralEquatable b = ValueTuple.Create(1, 2, 3, 0, 5);
Console.WriteLine(a.Equals(b, EqualityComparer<object>.Default));
await Task.Delay(-1);
Expected behavior
False
Actual behavior
True
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Description
Some
ValueTuples'IStructuralEquatable.Equalsmethods skip comparing Item4.runtime/src/libraries/System.Private.CoreLib/src/System/ValueTuple.cs
Lines 1123 to 1128 in 91ac6b3
Search
vt.Item3) &&in that file to find more.Reproduction Steps
Expected behavior
False
Actual behavior
True
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response