Skip to content

Do not overwrite JsonException metadata #56903

New issue

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

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

Already on GitHub? # to your account

Conversation

eiriktsarpalis
Copy link
Member

Addresses a condition where making nested calls to JsonSerializer can result in JsonException metadata being overwritten by the outer serializer. The serializer will now recognize exception instances where JsonSerializer.Path is already populated and bubble them up without any modification (treating them like any other exception type).

Fixes #51537.

@ghost
Copy link

ghost commented Aug 5, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

Addresses a condition where making nested calls to JsonSerializer can result in JsonException metadata being overwritten by the outer serializer. The serializer will now recognize exception instances where JsonSerializer.Path is already populated and bubble them up without any modification (treating them like any other exception type).

Fixes #51537.

Author: eiriktsarpalis
Assignees: eiriktsarpalis
Labels:

area-System.Text.Json

Milestone: 6.0.0

Copy link
Member

@steveharter steveharter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; minor potential semantic change with empty exception string

@eiriktsarpalis eiriktsarpalis merged commit 555e599 into dotnet:main Aug 5, 2021
@eiriktsarpalis eiriktsarpalis deleted the fix-jsonexception-metadata-overwrite branch August 5, 2021 15:07
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System.Text.Json: Preserve JsonException.Path
2 participants