Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix InvalidCastException when casting a polymorphic converter #73259

Merged

Conversation

eiriktsarpalis
Copy link
Member

Has been largely fixed thanks to the infrastructural changes in #70435 and #72789. This adds a fix for the case of dictionary converters that was missed out and includes a regression test for the original bug report.

Fix #46522.

@ghost
Copy link

ghost commented Aug 2, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Has been largely fixed thanks to the infrastructural changes in #70435 and #72789. This adds a fix for the case of dictionary converters that was missed out and includes a regression test for the original bug report.

Fix #46522.

Author: eiriktsarpalis
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@eiriktsarpalis
Copy link
Member Author

I've expanded the scope of this PR somewhat, incorporating equivalent fixes & testing for the serialization case. The PR also includes a few additional changes, tidying up logic around the casting converter and ensuring we never layer multiple casting converters on top of each other.

@eiriktsarpalis eiriktsarpalis merged commit 247bcdc into dotnet:main Aug 4, 2022
@eiriktsarpalis eiriktsarpalis deleted the fix-converter-invalidcastexception branch August 4, 2022 21:24
@ghost ghost locked as resolved and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JsonSerializer throw an InvalidCastException when serializing an array of item with a custom converter
3 participants