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

Consider tracking JSON path while deserializing JsonElement to return better JsonException #32359

Closed
ahsonkhan opened this issue Feb 15, 2020 · 1 comment

Comments

@ahsonkhan
Copy link
Contributor

We should only do this if it doesn't regress JsonElement performance noticably.

[Fact]
[ActiveIssue("JsonElement needs to support Path")]
public static void ExtensionPropertyRoundTripFails()
{
try
{
JsonSerializer.Deserialize<ClassWithExtensionProperty>(@"{""MyNestedClass"":{""UnknownProperty"":bad}}");
Assert.True(false, "Expected JsonException was not thrown.");
}
catch (JsonException e)
{
// Until JsonElement supports populating Path ("UnknownProperty"), which will be prepended by the serializer ("MyNestedClass"), this will fail.
Assert.Equal("$.MyNestedClass.UnknownProperty", e.Path);
}
}

cc @steveharter

@ahsonkhan ahsonkhan added this to the Future milestone Feb 15, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Feb 15, 2020
@ahsonkhan ahsonkhan removed the untriaged New issue has not been triaged by the area owner label Feb 15, 2020
@layomia
Copy link
Contributor

layomia commented Feb 21, 2020

Closing as duplicate of #29715.

@layomia layomia closed this as completed Feb 21, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants