Skip to content

2D test failing due to change in GetHashCode in Core 3 #848

Closed
@grubioe

Description

@grubioe

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:

///<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:

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

Metadata

Metadata

Assignees

Labels

rank20Rank: Priority/rank on a scale of (1..100)regressionstatus: This issue is a regression from a previous build or release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions