Skip to content

Conversation

@layomia
Copy link
Contributor

@layomia layomia commented Dec 2, 2020

Ports #42835 to 5.0
Fixes #44726 in 5.0

Description

Support for non-string dictionary keys was added in 5.0 (PR, design doc). This support is scoped to primitives such as DateTime, int etc. This change fixes a bug in that feature where InvalidCastException is thrown when deserializing the following dictionary types (exhaustive list) and the key type is not typeof(string):

  • typeof(IDictionary<,>)
  • typeof(ImmutableDictionary<,>)
  • typeof(IImmutableDictionary<,>)
  • typeof(IReadOnlyDictionary<,>)

Customer Impact

Successful deserialization of the above cases. Customers can avoid increased concept count of knowing which dictionary types work and which ones fail.

Regression

Not a regression since it was a new feature in 5.0.

Testing

Unit tests have been added to verify the expected behavior.

Risk

Little to none. This is a very scoped change to address this issue only.

@layomia layomia added this to the 5.0.2 milestone Dec 2, 2020
@layomia layomia self-assigned this Dec 2, 2020
@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Dec 8, 2020
@layomia layomia merged commit e9c9a2f into dotnet:release/5.0 Dec 8, 2020
@layomia layomia deleted the dictionary_5.0 branch December 8, 2020 18:36
@ghost ghost locked as resolved and limited conversation to collaborators Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Text.Json Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants