Skip to content

Commit edf97c4

Browse files
Remove porting tool artifacts and cross-reference the new JSO.Respect* properties.
1 parent ff47d48 commit edf97c4

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

xml/System.Text.Json/JsonSerializerOptions.xml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,17 +1162,23 @@ Use <xref:System.Text.Json.Serialization.ReferenceHandler.Preserve> to enable un
11621162
<summary>Gets or sets a value that indicates whether nullability annotations should be respected during serialization and deserialization.</summary>
11631163
<value>To be added.</value>
11641164
<remarks>
1165-
<para>Nullability annotations are resolved from the properties, fields and constructor parameters</para>
1166-
<para>that are used by the serializer. This includes annotations stemming from attributes such as</para>
11671165
<para>
1168-
<see cref="T:System.Diagnostics.CodeAnalysis.NotNullAttribute" />, <see cref="T:System.Diagnostics.CodeAnalysis.MaybeNullAttribute" />,</para>
1166+
Nullability annotations are resolved from the properties, fields and constructor parameters
1167+
that are used by the serializer. This includes annotations stemming from attributes such as
1168+
<see cref="T:System.Diagnostics.CodeAnalysis.NotNullAttribute" />, <see cref="T:System.Diagnostics.CodeAnalysis.MaybeNullAttribute" />,
1169+
<see cref="T:System.Diagnostics.CodeAnalysis.AllowNullAttribute" /> and <see cref="T:System.Diagnostics.CodeAnalysis.DisallowNullAttribute" />.
1170+
</para>
11691171
<para>
1170-
<see cref="T:System.Diagnostics.CodeAnalysis.AllowNullAttribute" /> and <see cref="T:System.Diagnostics.CodeAnalysis.DisallowNullAttribute" />.</para>
1171-
<para>Due to restrictions in how nullable reference types are represented at run time,</para>
1172-
<para>this setting only governs nullability annotations of non-generic properties and fields.</para>
1173-
<para>It cannot be used to enforce nullability annotations of root-level types or generic parameters.</para>
1174-
<para>The default setting for this property can be toggled application-wide using the</para>
1175-
<para>"System.Text.Json.Serialization.RespectNullableAnnotationsDefault" feature switch.</para>
1172+
Due to restrictions in how nullable reference types are represented at run time,
1173+
this setting only governs nullability annotations of non-generic properties and fields.
1174+
It cannot be used to enforce nullability annotations of root-level types, collection elements, or generic parameters.
1175+
The default setting for this property can be toggled application-wide using the
1176+
"System.Text.Json.Serialization.RespectNullableAnnotationsDefault" feature switch.
1177+
</para>
1178+
<para>
1179+
It is recommended that new applications always set this property to <see langword="true" />,
1180+
in combination with the closely related <see cref="P:System.Text.Json.JsonSerializerOptions.RespectRequiredConstructorParameters" /> property.
1181+
</para>
11761182
</remarks>
11771183
<exception cref="T:System.InvalidOperationException">Thrown if this property is set after serialization or deserialization has occurred.</exception>
11781184
</Docs>
@@ -1196,10 +1202,17 @@ Use <xref:System.Text.Json.Serialization.ReferenceHandler.Preserve> to enable un
11961202
<summary>Gets or sets a value that indicates whether non-optional constructor parameters should be specified during deserialization.</summary>
11971203
<value>To be added.</value>
11981204
<remarks>
1199-
<para>For historical reasons constructor-based deserialization treats all constructor parameters as optional by default.</para>
1200-
<para>This flag allows users to toggle that behavior as necessary for each <see cref="T:System.Text.Json.JsonSerializerOptions" /> instance.</para>
1201-
<para>The default setting for this property can be toggled application-wide using the</para>
1202-
<para>"System.Text.Json.Serialization.RespectRequiredConstructorParametersDefault" feature switch.</para>
1205+
<para>
1206+
For historical reasons constructor-based deserialization treats all constructor parameters as optional by default,
1207+
filling missing parameters with default values when they are not present in the JSON payload.
1208+
This flag allows users to toggle that behavior as necessary for each <see cref="T:System.Text.Json.JsonSerializerOptions" /> instance.
1209+
The default setting for this property can be toggled application-wide using the
1210+
"System.Text.Json.Serialization.RespectRequiredConstructorParametersDefault" feature switch.
1211+
</para>
1212+
<para>
1213+
It is recommended that new applications always set this property to <see langword="true" />,
1214+
in combination with the closely related <see cref="P:System.Text.Json.JsonSerializerOptions.RespectNullableAnnotations" /> property.
1215+
</para>
12031216
</remarks>
12041217
<exception cref="T:System.InvalidOperationException">Thrown if this property is set after serialization or deserialization has occurred.</exception>
12051218
</Docs>

0 commit comments

Comments
 (0)