@@ -1162,17 +1162,23 @@ Use <xref:System.Text.Json.Serialization.ReferenceHandler.Preserve> to enable un
1162
1162
<summary >Gets or sets a value that indicates whether nullability annotations should be respected during serialization and deserialization.</summary >
1163
1163
<value >To be added.</value >
1164
1164
<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 >
1167
1165
<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 >
1169
1171
<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 >
1176
1182
</remarks >
1177
1183
<exception cref =" T:System.InvalidOperationException" >Thrown if this property is set after serialization or deserialization has occurred.</exception >
1178
1184
</Docs >
@@ -1196,10 +1202,17 @@ Use <xref:System.Text.Json.Serialization.ReferenceHandler.Preserve> to enable un
1196
1202
<summary >Gets or sets a value that indicates whether non-optional constructor parameters should be specified during deserialization.</summary >
1197
1203
<value >To be added.</value >
1198
1204
<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 >
1203
1216
</remarks >
1204
1217
<exception cref =" T:System.InvalidOperationException" >Thrown if this property is set after serialization or deserialization has occurred.</exception >
1205
1218
</Docs >
0 commit comments