-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
JsonNode trimmability improvements #52934
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,8 @@ internal JsonArray (JsonElement element, JsonNodeOptions? options = null) : base | |
/// <param name="value"> | ||
/// The object to be added to the end of the <see cref="JsonArray"/>. | ||
/// </param> | ||
public void Add<T>(T? value) | ||
[RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)] | ||
public void Add<[DynamicallyAccessedMembers(JsonHelpers.MembersAccessedOnRead)]T>(T? value) | ||
{ | ||
if (value == null) | ||
{ | ||
|
@@ -109,7 +110,7 @@ public void Add<T>(T? value) | |
JsonNode? jNode = value as JsonNode; | ||
if (jNode == null) | ||
{ | ||
jNode = new JsonValue<T>(value); | ||
jNode = new JsonValueNotTrimmable<T>(value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So adding a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a safe version that takes JsonNode. This overload was requested by the Azure SDK team. However, it is optional and could be removed since it does lead to unsafe-for-trimming paths. |
||
} | ||
|
||
// Call the IList.Add() implementation. | ||
|
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.
This message is a little bit mis-leading since it says "Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or...". There is no overload that takes those types.