CatalogKey.GetHashCode() is case sensitive, can cause unwanted equality results

Found in

EPiServer.Commerce 11.0.0

Created

Sep 11 2017

Updated

Sep 22 2017

Fixed in

EPiServer.Commerce 11.2.4

Area

Core

State

Closed, Fixed and tested

Voting

Affected? You can raise the priority of a bug by voting for it. By doing so, you will be helping our developers to choose which bug to fix next.

Voting is disabled for closed bugs.

0

Description

Steps to reproduce

1. Create two CatalogKeys "abc123" and "ABC123".
2. Create a Dictionary<CatalogKey, object>();
3. Set dictionary[a] = new object();
4. Call dictionary.ContainsKey(b);

Expected: CatalogEntryCode is case-insensitive, so CatalogKey.GetHashCode() should convert it to upper or lower case first.

Actual: CatalogKey.GetHashCode() is case sensitive, so using it to do comparisons like dictionary lookup causes a result of "False" to be returned.

Comments