Skip to content
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
am11:fix/NRE-to-JE-for-generic-interface-list
Sep 5, 2019
Merged

Raise JsonException when PolicyProperty is null#40501
steveharter merged 1 commit intodotnet:masterfrom
am11:fix/NRE-to-JE-for-generic-interface-list

Conversation

@am11
Copy link
Member

@am11 am11 commented Aug 22, 2019

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

@layomia
Copy link
Contributor

layomia commented Aug 22, 2019

cc @steveharter

@steveharter
Copy link
Contributor

This is different than what was proposed in #40449: throw
NotSupportedException now and when interface support is added, raise
JsonException.

Agree; JsonException is correct here.

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 ahsonkhan modified the milestones: 3.0, 5.0 Aug 31, 2019
@steveharter steveharter merged commit 5dbbdfa into dotnet:master Sep 5, 2019
@am11 am11 deleted the fix/NRE-to-JE-for-generic-interface-list branch September 5, 2019 16:36
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
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.

5 participants