This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Raise JsonException when PolicyProperty is null#40501
Merged
steveharter merged 1 commit intodotnet:masterfrom Sep 5, 2019
am11:fix/NRE-to-JE-for-generic-interface-list
Merged
Raise JsonException when PolicyProperty is null#40501steveharter merged 1 commit intodotnet:masterfrom am11:fix/NRE-to-JE-for-generic-interface-list
steveharter merged 1 commit intodotnet:masterfrom
am11:fix/NRE-to-JE-for-generic-interface-list
Conversation
Contributor
|
cc @steveharter |
steveharter
reviewed
Aug 29, 2019
src/System.Text.Json/src/System/Text/Json/Serialization/JsonPropertyInfo.cs
Outdated
Show resolved
Hide resolved
Contributor
Agree; |
Current approach of deserializer is that if the token being handled is unexpected, `JsonException` is raised before typechecking/validating the target type. Which means it is later when `NotSupportedException` is issued due to the lack of interface support. Therefore, this PR changes the flow leading to `NullReferenceException` to `JsonException` to align it with other unexpected token cases. This is different than what was proposed in #40449: throw `NotSupportedException` now and when interface support is added, raise `JsonException`. This approach is future proof and agnostic of interface support. Addresses #40449
ahsonkhan
approved these changes
Aug 31, 2019
steveharter
approved these changes
Sep 5, 2019
steveharter
added a commit
that referenced
this pull request
Oct 14, 2019
steveharter
added a commit
to steveharter/dotnet_corefx
that referenced
this pull request
Oct 14, 2019
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current approach of deserializer is that if the token being handled is
unexpected,
JsonExceptionis raised before typechecking/validatingthe target type. Which means it is later when
NotSupportedExceptionis issued due to the lack of interface support.
Therefore, this PR changes the flow leading to
NullReferenceExceptionto
JsonExceptionto align it with other unexpected token cases.This is different than what was proposed in #40449: throw
NotSupportedExceptionnow and when interface support is added, raiseJsonException. This approach is future proof and agnostic ofinterface support.
Addresses #40449