From 15d9885fa0302ca23c96f5247c853ebb8dcbff7c Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Fri, 15 Sep 2023 18:37:11 +0100 Subject: [PATCH 1/2] Add missing STJ xml docs --- .../src/System/BinaryDataConverter.cs | 6 +++ .../src/CompatibilitySuppressions.xml | 48 +++++++++++++++++++ .../src/System/Text/Json/Nodes/JsonArray.cs | 3 +- .../src/System/Text/Json/Nodes/JsonNode.cs | 1 + .../JsonObjectCreationHandlingAttribute.cs | 5 ++ .../JsonUnmappedMemberHandlingAttribute.cs | 5 ++ .../Serialization/JsonConverterFactory.cs | 1 + .../Json/Serialization/JsonConverterOfT.cs | 1 + .../Serialization/JsonNumberEnumConverter.cs | 5 ++ .../JsonSerializer.Read.Document.cs | 1 + 10 files changed, 75 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Memory.Data/src/System/BinaryDataConverter.cs b/src/libraries/System.Memory.Data/src/System/BinaryDataConverter.cs index aa144e0622b3de..f4c78399fa8195 100644 --- a/src/libraries/System.Memory.Data/src/System/BinaryDataConverter.cs +++ b/src/libraries/System.Memory.Data/src/System/BinaryDataConverter.cs @@ -8,6 +8,12 @@ namespace System.Text.Json.Serialization /// public sealed class BinaryDataJsonConverter : JsonConverter { + /// + /// Initializes a new instance of the . + /// + public BinaryDataJsonConverter() + { } + /// public override BinaryData? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { diff --git a/src/libraries/System.Text.Json/src/CompatibilitySuppressions.xml b/src/libraries/System.Text.Json/src/CompatibilitySuppressions.xml index 59676209362345..6d4b54c1fd405b 100644 --- a/src/libraries/System.Text.Json/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Text.Json/src/CompatibilitySuppressions.xml @@ -57,6 +57,54 @@ lib/netstandard2.0/System.Text.Json.dll true + + CP0002 + M:System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute.#ctor + ref/net462/System.Text.Json.dll + lib/net462/System.Text.Json.dll + + + CP0002 + M:System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute.#ctor + ref/net462/System.Text.Json.dll + lib/net462/System.Text.Json.dll + + + CP0002 + M:System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute.#ctor + ref/net8.0/System.Text.Json.dll + lib/net8.0/System.Text.Json.dll + + + CP0002 + M:System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute.#ctor + ref/net8.0/System.Text.Json.dll + lib/net8.0/System.Text.Json.dll + + + CP0002 + M:System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute.#ctor + ref/net9.0/System.Text.Json.dll + lib/net9.0/System.Text.Json.dll + + + CP0002 + M:System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute.#ctor + ref/net9.0/System.Text.Json.dll + lib/net9.0/System.Text.Json.dll + + + CP0002 + M:System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute.#ctor + ref/netstandard2.0/System.Text.Json.dll + lib/netstandard2.0/System.Text.Json.dll + + + CP0002 + M:System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute.#ctor + ref/netstandard2.0/System.Text.Json.dll + lib/netstandard2.0/System.Text.Json.dll + CP0014 M:System.Text.Json.JsonSerializerOptions.AddContext``1:[T:System.ObsoleteAttribute] diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonArray.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonArray.cs index 8dc0924ad36e61..9ae40a15ea66f6 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonArray.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonArray.cs @@ -113,9 +113,10 @@ internal int GetElementIndex(JsonNode? node) } /// - /// Returns enumerator that wraps calls to . + /// Returns an enumerable that wraps calls to . /// /// The type of the value to obtain from the . + /// An enumerable iterating over values of the array. public IEnumerable GetValues() { foreach (JsonNode? item in List) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs index a06fc47cfc1c42..1d38e494da611c 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonNode.cs @@ -242,6 +242,7 @@ public JsonNode? this[string propertyName] /// /// Creates a new instance of the . All children nodes are recursively cloned. /// + /// A new cloned instance of the current node. public JsonNode DeepClone() => DeepCloneCore(); internal abstract JsonNode DeepCloneCore(); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonObjectCreationHandlingAttribute.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonObjectCreationHandlingAttribute.cs index 718bdc744b6854..bb7d800d7a43ca 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonObjectCreationHandlingAttribute.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonObjectCreationHandlingAttribute.cs @@ -31,6 +31,11 @@ namespace System.Text.Json.Serialization; [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)] public sealed class JsonObjectCreationHandlingAttribute : JsonAttribute { + /// + /// Initializes a new instance of . + /// + public JsonObjectCreationHandlingAttribute() { } + /// /// Indicates what configuration should be used when deserializing members. /// diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonUnmappedMemberHandlingAttribute.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonUnmappedMemberHandlingAttribute.cs index 6004ea91d82ed3..01d33a3131d06e 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonUnmappedMemberHandlingAttribute.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonUnmappedMemberHandlingAttribute.cs @@ -11,6 +11,11 @@ namespace System.Text.Json.Serialization AllowMultiple = false, Inherited = false)] public class JsonUnmappedMemberHandlingAttribute : JsonAttribute { + /// + /// Initializes a new instance of . + /// + public JsonUnmappedMemberHandlingAttribute() { } + /// /// Initializes a new instance of . /// diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterFactory.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterFactory.cs index 973d3692f2d8f3..7537fa0d833be2 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterFactory.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterFactory.cs @@ -142,6 +142,7 @@ internal sealed override void WriteAsPropertyNameAsObject(Utf8JsonWriter writer, throw new InvalidOperationException(); } + /// public sealed override Type? Type => null; internal sealed override void WriteAsPropertyNameCoreAsObject( diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs index 490d8349ed8ef5..cbe509480f36df 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs @@ -498,6 +498,7 @@ internal bool TryWriteDataExtensionProperty(Utf8JsonWriter writer, T value, Json return success; } + /// public sealed override Type Type { get; } = typeof(T); internal void VerifyRead(JsonTokenType tokenType, int depth, long bytesConsumed, bool isValueConverter, ref Utf8JsonReader reader) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonNumberEnumConverter.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonNumberEnumConverter.cs index f2c41af4dbefc0..fa7c190f4f3ea1 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonNumberEnumConverter.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonNumberEnumConverter.cs @@ -17,6 +17,11 @@ namespace System.Text.Json.Serialization public sealed class JsonNumberEnumConverter : JsonConverterFactory where TEnum : struct, Enum { + /// + /// Initializes a new instance of . + /// + public JsonNumberEnumConverter() { } + /// public override bool CanConvert(Type typeToConvert) => typeToConvert == typeof(TEnum); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.Document.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.Document.cs index 5d47b54b022177..8f7aefcbc30a3c 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.Document.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.Document.cs @@ -113,6 +113,7 @@ public static partial class JsonSerializer /// /// The to convert. /// Metadata about the type to convert. + /// A representation of the JSON value. /// /// is . /// From bbbd63e2ae954e48d23f80ac9a4ed55540c408fe Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Fri, 15 Sep 2023 19:35:35 +0100 Subject: [PATCH 2/2] fix docs and remove suppressions --- .../src/CompatibilitySuppressions.xml | 48 ------------------- .../JsonObjectCreationHandlingAttribute.cs | 6 +-- .../JsonUnmappedMemberHandlingAttribute.cs | 6 +-- 3 files changed, 2 insertions(+), 58 deletions(-) diff --git a/src/libraries/System.Text.Json/src/CompatibilitySuppressions.xml b/src/libraries/System.Text.Json/src/CompatibilitySuppressions.xml index 6d4b54c1fd405b..59676209362345 100644 --- a/src/libraries/System.Text.Json/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Text.Json/src/CompatibilitySuppressions.xml @@ -57,54 +57,6 @@ lib/netstandard2.0/System.Text.Json.dll true - - CP0002 - M:System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute.#ctor - ref/net462/System.Text.Json.dll - lib/net462/System.Text.Json.dll - - - CP0002 - M:System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute.#ctor - ref/net462/System.Text.Json.dll - lib/net462/System.Text.Json.dll - - - CP0002 - M:System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute.#ctor - ref/net8.0/System.Text.Json.dll - lib/net8.0/System.Text.Json.dll - - - CP0002 - M:System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute.#ctor - ref/net8.0/System.Text.Json.dll - lib/net8.0/System.Text.Json.dll - - - CP0002 - M:System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute.#ctor - ref/net9.0/System.Text.Json.dll - lib/net9.0/System.Text.Json.dll - - - CP0002 - M:System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute.#ctor - ref/net9.0/System.Text.Json.dll - lib/net9.0/System.Text.Json.dll - - - CP0002 - M:System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute.#ctor - ref/netstandard2.0/System.Text.Json.dll - lib/netstandard2.0/System.Text.Json.dll - - - CP0002 - M:System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute.#ctor - ref/netstandard2.0/System.Text.Json.dll - lib/netstandard2.0/System.Text.Json.dll - CP0014 M:System.Text.Json.JsonSerializerOptions.AddContext``1:[T:System.ObsoleteAttribute] diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonObjectCreationHandlingAttribute.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonObjectCreationHandlingAttribute.cs index bb7d800d7a43ca..7f8a0cbe740cf8 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonObjectCreationHandlingAttribute.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonObjectCreationHandlingAttribute.cs @@ -31,11 +31,6 @@ namespace System.Text.Json.Serialization; [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)] public sealed class JsonObjectCreationHandlingAttribute : JsonAttribute { - /// - /// Initializes a new instance of . - /// - public JsonObjectCreationHandlingAttribute() { } - /// /// Indicates what configuration should be used when deserializing members. /// @@ -44,6 +39,7 @@ public JsonObjectCreationHandlingAttribute() { } /// /// Initializes a new instance of . /// + /// The handling to apply to the current member. public JsonObjectCreationHandlingAttribute(JsonObjectCreationHandling handling) { if (!JsonSerializer.IsValidCreationHandlingValue(handling)) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonUnmappedMemberHandlingAttribute.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonUnmappedMemberHandlingAttribute.cs index 01d33a3131d06e..ef99a901ade987 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonUnmappedMemberHandlingAttribute.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonUnmappedMemberHandlingAttribute.cs @@ -14,11 +14,7 @@ public class JsonUnmappedMemberHandlingAttribute : JsonAttribute /// /// Initializes a new instance of . /// - public JsonUnmappedMemberHandlingAttribute() { } - - /// - /// Initializes a new instance of . - /// + /// The handling to apply to the current member. public JsonUnmappedMemberHandlingAttribute(JsonUnmappedMemberHandling unmappedMemberHandling) { UnmappedMemberHandling = unmappedMemberHandling;