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

Support safe trimmability for System.Text.Json.Nodes.JsonValue #52773

Closed
steveharter opened this issue May 14, 2021 · 3 comments · Fixed by #52934
Closed

Support safe trimmability for System.Text.Json.Nodes.JsonValue #52773

steveharter opened this issue May 14, 2021 · 3 comments · Fixed by #52934
Assignees
Labels
api-approved API was approved in API review, it can be implemented area-System.Text.Json blocking Marks issues that we want to fast track in order to unblock other important work linkable-framework Issues associated with delivering a linker friendly framework
Milestone

Comments

@steveharter
Copy link
Member

steveharter commented May 14, 2021

Background and Motivation

The existing JsonValue class has a factory method like:

public static JsonValue? Create<T>(T? value, JsonNodeOptions? options = null);

When called with a primitive such as an Int32 or string this method is safe for trimming. However, this method also supports any serializable CLR type including custom data types, anonymous types and even POCOs and collections, so it is unsafe for trimming since it needs to call the serializer.

Separating the safe vs. unsafe creation is necessary to avoid having to add unsafe trimming attributes to this method.

See this issue for more information: #52002

Proposed API

namespace System.Text.Json.Nodes
{
  public partial class JsonValue
  {
    // Here is the safe version that supports JsonTypeInfo with source-generated types:
+  public static JsonValue? Create<T>(T? value, JsonTypeInfo<T> jsonTypeInfo, JsonNodeOptions? options = null)

    // Here is the unsafe version with a name that makes that clear:
-  public static JsonValue? Create<T>(T? value, JsonNodeOptions? options = null)
+  public static JsonValue? CreateFromSerializableValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]T>(T? value, JsonNodeOptions? options = null)
  }

    // To maintain compatibility with the removed `Create<T>`, here are safe overloads for each supported primitive value:
+  public static JsonValue Create(bool value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(byte value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(char value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(System.DateTime value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(System.DateTimeOffset value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(decimal value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(double value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(System.Guid value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(short value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(int value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(long value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(bool? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(byte? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(char? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTimeOffset? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTime? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(decimal? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(double? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Guid? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(short? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(int? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(long? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(sbyte? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(float? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Text.Json.JsonElement? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ushort? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(uint? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ulong? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue Create(sbyte value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(float value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(string? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Text.Json.JsonElement value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue Create(ushort value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue Create(uint value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue Create(ulong value, JsonNodeOptions? options = default(JsonNodeOptions?));
}

In addition, operators are added to support JsonElement which is the only supported type that did not have operators yet:

namespace System.Text.Json.Nodes
{
  public partial class JsonNode
  {
+  public static implicit operator JsonNode? (System.Text.Json.JsonElement value);
+  public static implicit operator JsonNode? (System.Text.Json.JsonElement? value);
+  public static explicit operator System.Text.Json.JsonElement (JsonNode value);
+  public static explicit operator System.Text.Json.JsonElement? (JsonNode? value);
  }
}

Note that JsonElement is handled specially: an internal value of JsonValueKind.Null is treated as a null JsonValue. This is required since JsonValue is based on JsonElement after a Parse() and treats null JSON values as a null CLR value.

Alternative Designs

Only supporting primitive types and not custom data types, anonymous types, etc would prevent the need for CreateFromSerializableValue() but we would still likely want the various new Create() overloads for each supported value type to make the expected types known at compile-time (instead of throwing at run-time). If we did not support custom data types, etc then users would need to:

  • Use the serializer and create POCOs (not always feasible)
  • Create helper methods to generate JSON from a custom data type, etc.

These may include invoking the non-trimmable serializer APIs and thus doesn't really help from a safe trimability perspective.

@steveharter steveharter added area-System.Text.Json blocking Marks issues that we want to fast track in order to unblock other important work api-ready-for-review API is ready for review, it is NOT ready for implementation labels May 14, 2021
@steveharter steveharter self-assigned this May 14, 2021
@ghost
Copy link

ghost commented May 14, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

Background and Motivation

The existing JsonValue class has a factory method like:

public static JsonValue? Create<T>(T? value, JsonNodeOptions? options = null);

When called with a primitive such as an Int32 or string this method is safe for trimming. However, this method also supports any serializable CLR type including custom data types, anonymous types and even POCOs and collections, so it is unsafe for trimming since it needs to call the serializer.

Separating the safe vs. unsafe creation is necessary to avoid having to add unsafe trimming attributes to this method.

See this issue for more information: #52002

Proposed API

namespace System.Text.Json.Nodes
{
  public partial class JsonValue
  {
    // Here is the safe version that supports JsonTypeInfo with source-generated types:
+  public static JsonValue? Create<T>(T? value, JsonTypeInfo<T> jsonTypeInfo, JsonNodeOptions? options = null)

    // Here is the unsafe version with a name that makes that clear:
-  public static JsonValue? Create<T>(T? value, JsonNodeOptions? options = null)
+  public static JsonValue? CreateFromSerializableValue<T>(T? value, JsonNodeOptions? options = null)
  }

    // To maintain compatibility with the removed `Create<T>`, here are safe overloads for each supported primitive value:
+  public static JsonValue? Create(bool value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(byte value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(char value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTime value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTimeOffset value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(decimal value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(double value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Guid value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(short value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(int value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(long value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(bool? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(byte? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(char? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTimeOffset? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTime? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(decimal? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(double? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Guid? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(short? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(int? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(long? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(sbyte? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(float? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Text.Json.JsonElement? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ushort? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(uint? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ulong? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(sbyte value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(float value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(string value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Text.Json.JsonElement value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ushort value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(uint value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ulong value, JsonNodeOptions? options = default(JsonNodeOptions?));
}

In addition, operators are added to support JsonElement which is the only supported type that did not have operators yet:

namespace System.Text.Json.Nodes
{
  public partial class JsonNode
  {
+  public static implicit operator JsonNode (System.Text.Json.JsonElement value);
+  public static implicit operator JsonNode? (System.Text.Json.JsonElement? value);
+  public static explicit operator System.Text.Json.JsonElement (JsonNode value);
+  public static explicit operator System.Text.Json.JsonElement? (JsonNode? value);
  }
}

Alternative Designs

Only supporting primitive types and not custom data types, anonymous types, etc would prevent the need for CreateFromSerializableValue() but we would still likely want the various new Create() overloads for each supported value type. If we did not support custom data types, etc then users would need to:

  • Use the serializer and create POCOs (not always feasible)
  • Create helper methods to generate JSON from a custom data type, etc.

These may include invoking the non-trimmable serializer APIs and thus doesn't really help from a safe trimability perspective.

Author: steveharter
Assignees: steveharter
Labels:

api-ready-for-review, area-System.Text.Json, blocking

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label May 14, 2021
@steveharter steveharter changed the title Support safe trimmability for System.Text.Json.JsonValue Support safe trimmability for System.Text.Json.Nodes.JsonValue May 14, 2021
@steveharter steveharter removed the untriaged New issue has not been triaged by the area owner label May 14, 2021
@steveharter steveharter added this to the 6.0.0 milestone May 14, 2021
@marek-safar marek-safar added the linkable-framework Issues associated with delivering a linker friendly framework label May 14, 2021
@ghost
Copy link

ghost commented May 14, 2021

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer
See info in area-owners.md if you want to be subscribed.

Issue Details

Background and Motivation

The existing JsonValue class has a factory method like:

public static JsonValue? Create<T>(T? value, JsonNodeOptions? options = null);

When called with a primitive such as an Int32 or string this method is safe for trimming. However, this method also supports any serializable CLR type including custom data types, anonymous types and even POCOs and collections, so it is unsafe for trimming since it needs to call the serializer.

Separating the safe vs. unsafe creation is necessary to avoid having to add unsafe trimming attributes to this method.

See this issue for more information: #52002

Proposed API

namespace System.Text.Json.Nodes
{
  public partial class JsonValue
  {
    // Here is the safe version that supports JsonTypeInfo with source-generated types:
+  public static JsonValue? Create<T>(T? value, JsonTypeInfo<T> jsonTypeInfo, JsonNodeOptions? options = null)

    // Here is the unsafe version with a name that makes that clear:
-  public static JsonValue? Create<T>(T? value, JsonNodeOptions? options = null)
+  public static JsonValue? CreateFromSerializableValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]T>(T? value, JsonNodeOptions? options = null)
  }

    // To maintain compatibility with the removed `Create<T>`, here are safe overloads for each supported primitive value:
+  public static JsonValue? Create(bool value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(byte value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(char value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTime value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTimeOffset value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(decimal value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(double value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Guid value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(short value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(int value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(long value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(bool? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(byte? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(char? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTimeOffset? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTime? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(decimal? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(double? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Guid? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(short? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(int? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(long? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(sbyte? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(float? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Text.Json.JsonElement? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ushort? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(uint? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ulong? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(sbyte value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(float value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(string value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Text.Json.JsonElement value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ushort value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(uint value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ulong value, JsonNodeOptions? options = default(JsonNodeOptions?));
}

In addition, operators are added to support JsonElement which is the only supported type that did not have operators yet:

namespace System.Text.Json.Nodes
{
  public partial class JsonNode
  {
+  public static implicit operator JsonNode (System.Text.Json.JsonElement value);
+  public static implicit operator JsonNode? (System.Text.Json.JsonElement? value);
+  public static explicit operator System.Text.Json.JsonElement (JsonNode value);
+  public static explicit operator System.Text.Json.JsonElement? (JsonNode? value);
  }
}

Alternative Designs

Only supporting primitive types and not custom data types, anonymous types, etc would prevent the need for CreateFromSerializableValue() but we would still likely want the various new Create() overloads for each supported value type. If we did not support custom data types, etc then users would need to:

  • Use the serializer and create POCOs (not always feasible)
  • Create helper methods to generate JSON from a custom data type, etc.

These may include invoking the non-trimmable serializer APIs and thus doesn't really help from a safe trimability perspective.

Author: steveharter
Assignees: steveharter
Labels:

api-ready-for-review, area-System.Text.Json, blocking, linkable-framework

Milestone: 6.0.0

@bartonjs
Copy link
Member

bartonjs commented May 18, 2021

Video

We didn't feel it was worth renaming the linker-unfriendly version. So now it's just adding the specialized versions.

We discussed the operators, and had some mixed feelings. Since they're not quite related to the rest of the changes we removed them from here (they can be brought up later as a separate issue).

namespace System.Text.Json.Nodes
{
  public partial class JsonValue
  {
+  public static JsonValue? Create<T>(T? value, JsonTypeInfo<T> jsonTypeInfo, JsonNodeOptions? options = null)

-  public static JsonValue? Create<T>(T? value, JsonNodeOptions? options = null)
+  public static JsonValue? Create<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]T>(T? value, JsonNodeOptions? options = null)

+  public static JsonValue Create(bool value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(byte value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(char value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(System.DateTime value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(System.DateTimeOffset value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(decimal value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(double value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(System.Guid value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(short value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(int value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(long value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(bool? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(byte? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(char? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTimeOffset? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.DateTime? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(decimal? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(double? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Guid? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(short? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(int? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(long? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(sbyte? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(float? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Text.Json.JsonElement? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ushort? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(uint? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue? Create(ulong? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue Create(sbyte value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue Create(float value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(string? value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  public static JsonValue? Create(System.Text.Json.JsonElement value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue Create(ushort value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue Create(uint value, JsonNodeOptions? options = default(JsonNodeOptions?));
+  [System.CLSCompliantAttribute(false)]
+  public static JsonValue Create(ulong value, JsonNodeOptions? options = default(JsonNodeOptions?));
}

It also looks like JsonArray.Add<T> needs the dynamically accessed member attributes. Adding the appropriate attributes is also approved with this issue.

@bartonjs bartonjs added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for review, it is NOT ready for implementation labels May 18, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 18, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-System.Text.Json blocking Marks issues that we want to fast track in order to unblock other important work linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants