-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Copied from VSO ID: 803447
Test:
Name="Color API Test" Priority="1" Area="2D" SubArea="API Tests"
Fails due to a change in GetHashCode from corefx. What the test code is doing is generating 2 different colors and verifying that the resulting hash codes are not equal, the hashcode is calculated from System.Windows.Media.Color by overriding GetHashCode:
wpf/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Color.cs
Lines 214 to 220 in 9c5dd1a
///<summary> | |
/// GetHashCode | |
///</summary> | |
public override int GetHashCode() | |
{ | |
return this.scRgbColor.GetHashCode(); //^this.context.GetHashCode(); | |
} |
which essentially only returns the hashcode from its internal struct which is defined as:
wpf/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Color.cs
Lines 1158 to 1161 in 9c5dd1a
private struct MILColorF // this structure is the "milrendertypes.h" structure and should be identical for performance | |
{ | |
public float a, r, g, b; | |
}; |
in Framework different values for a,r,g,b would result in a different HashCode in Core it seems only the first value is considered for HashCode calculation, our test has the same first value so the hash code is the same.
As per corefx recommendation (https://github.com/dotnet/corefx/issues/35613) we should override and implement a correct HashCode mechanism for our 4 floats in MILColorF, ideally mirroring what Framework used to do