-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Ensure metadata originating from converters is surfaced while JsonTypeInfo is mutable. #72483
Ensure metadata originating from converters is surfaced while JsonTypeInfo is mutable. #72483
Conversation
…eInfo is mutable.
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsDiscovered while investigating #60560. Some of our internal converter implementations use the Contributes to #63686.
|
@@ -27,7 +28,7 @@ internal override object CreateObject(JsonSerializerOptions options) | |||
JsonObject jObject = (JsonObject)obj; | |||
|
|||
Debug.Assert(value == null || value is JsonNode); | |||
JsonNode? jNodeValue = (JsonNode?)value; | |||
JsonNode? jNodeValue = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider removing assert above
Discovered while investigating #60560.
Some of our internal converter implementations override the
JsonConverter.ConfigureJsonTypeInfo
method when needing to modify contract metadata. Currently, this configuration step is run after the metadata instance gets locked, so none of these changes are visible to contract resolver authors. This PR changes this so that the method in question is invoked at metadata construction time, and only when said metadata originates fromDefaultJsonTypeInfoResolver
orJsonSerializerContext
.Contributes to #63686.