Skip to content

Commit

Permalink
Create 521954 - BCL CultureAwareComparer with ignore casing on serial… (
Browse files Browse the repository at this point in the history
microsoft#553)

* Create 521954 - BCL CultureAwareComparer with ignore casing on serialized on previous versions of .NET do not correctly deserialize on .NET 4.7.1.md

* Update 521954 - BCL CultureAwareComparer with ignore casing on serialized on previous versions of .NET do not correctly deserialize on .NET 4.7.1.md

* Update 521954 - BCL CultureAwareComparer with ignore casing on serialized on previous versions of .NET do not correctly deserialize on .NET 4.7.1.md
  • Loading branch information
AlexGhiondea authored and vivmishra committed Nov 9, 2017
1 parent cbbc8b5 commit d90060b
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# CultureAwareComparer with ignore casing serialized on previous versions of .NET Framework does not correctly deserialize on .NET Framework 4.7.1

## Symptoms

When deserialzing a CultureAwareComparer that was serialized using ignore case on a previous version of .NET Framework on a machine running .NET Framework 4.7.1, the comparer becomes case sensitive.

## Cause

In the .NET Framework 4.7.1 we added the ability to specify more comparer options when doing a culture-aware comparison.
As part of that change we introduced a new field on the comparer that holds the information about what kind of comparison is requested.

When that type, coming from a version of .NET Framework prior to 4.7.1 is deserialized on a .NET Framework 4.7.1 machine, the private field introduced in the .NET Framework 4.7.1 is reset to zero, which makes the comparer case sensitive.

## Impact

The following 2 comparers are susceptible to this issue. These comparers are usually used with collection types like Dictionary and Hashtable.
P:System.StringComparer.InvariantCultureIgnoreCase
P:System.StringComparer.CurrentCultureIgnoreCase

## Workarounds

Ensure that both serialization and deserialization occurs on systems running a version of the .NET Framework starting with 4.7.1.

0 comments on commit d90060b

Please sign in to comment.