Skip to content

Add a JsonConverter.Type property. - #87382

Merged
eiriktsarpalis merged 1 commit into
dotnet:mainfrom
eiriktsarpalis:add/jsonconverter-type
Jun 12, 2023
Merged

Add a JsonConverter.Type property.#87382
eiriktsarpalis merged 1 commit into
dotnet:mainfrom
eiriktsarpalis:add/jsonconverter-type

Conversation

@eiriktsarpalis

Copy link
Copy Markdown
Member

Fix #63898.

@ghost

ghost commented Jun 11, 2023

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@eiriktsarpalis eiriktsarpalis self-assigned this Jun 11, 2023
@eiriktsarpalis eiriktsarpalis added this to the 8.0.0 milestone Jun 11, 2023
@ghost

ghost commented Jun 11, 2023

Copy link
Copy Markdown

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

Fix #63898.

Author: eiriktsarpalis
Assignees: -
Labels:

area-System.Text.Json, new-api-needs-documentation

Milestone: -
}
public static partial class JsonSerializer
{
public static bool IsReflectionEnabledByDefault { get { throw null; } }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A few unrelated reorderings caused by running the generation tool.

Assert.Equal("{}", json);

Assert.Throws<NotSupportedException>(() => JsonSerializer.Deserialize<JsonConverter>(json, PublicContext.Default.Options));
Assert.Throws<NotSupportedException>(() => JsonSerializer.Serialize(obj, PublicContext.Default.Options));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Attempting to serialize a JsonConverter will now throw since it carries an unsupported property of type Type. I think that's ok since it's not a particularly meaningful scenario.

@layomia layomia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@eiriktsarpalis
eiriktsarpalis merged commit 52bacbc into dotnet:main Jun 12, 2023
@eiriktsarpalis
eiriktsarpalis deleted the add/jsonconverter-type branch June 12, 2023 18:55
@ghost ghost locked as resolved and limited conversation to collaborators Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.