Skip to content

Commit bd2c14d

Browse files
authored
Add missing exceptions to JsonSerializer and JsonSerializerOptions (#3989)
* Add missing exceptions to JsonSerializer and JsonSerializerOptions * Add doc for missing InvalidOperationException * Add System namespace to exceptions
1 parent 161a251 commit bd2c14d

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

xml/System.Text.Json/JsonSerializer.xml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
6767
<exception cref="T:System.ArgumentNullException">
6868
<paramref name="returnType" /> is <see langword="null" />.</exception>
6969
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
70-
70+
7171
-or-
7272

7373
<typeparamref name="returnType" /> is not compatible with the JSON.
7474

7575
-or-
7676

7777
There is remaining data in the span beyond a single JSON value.</exception>
78+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="returnType"/> or its serializable members.</exception>
7879
</Docs>
7980
</Member>
8081
<Member MemberName="Deserialize">
@@ -127,6 +128,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
127128
-or-
128129

129130
There is remaining data in the string beyond a single JSON value.</exception>
131+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="returnType"/> or its serializable members.</exception>
130132
</Docs>
131133
</Member>
132134
<Member MemberName="Deserialize">
@@ -170,7 +172,6 @@ This method makes a copy of the data the reader acted on, so there is no caller
170172
The <xref:System.Text.Json.JsonReaderOptions> used to create the instance of the <xref:System.Text.Json.Utf8JsonReader> take precedence over the <xref:System.Text.Json.JsonSerializerOptions> when they conflict. Hence, <xref:System.Text.Json.JsonReaderOptions.AllowTrailingCommas?displayProperty=nameWithType>, <xref:System.Text.Json.JsonReaderOptions.MaxDepth?displayProperty=nameWithType>, and <xref:System.Text.Json.JsonReaderOptions.CommentHandling?displayProperty=nameWithType> are used while reading.
171173
172174
For more information, see [How to serialize and deserialize JSON](~/docs/standard/serialization/system-text-json-how-to.md).
173-
174175
]]></format>
175176
</remarks>
176177
<exception cref="T:System.ArgumentNullException">
@@ -186,6 +187,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
186187
A value could not be read from the reader.</exception>
187188
<exception cref="T:System.ArgumentException">
188189
<paramref name="reader" /> is using unsupported options.</exception>
190+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="returnType"/> or its serializable members.</exception>
189191
</Docs>
190192
</Member>
191193
<Member MemberName="Deserialize&lt;TValue&gt;">
@@ -227,14 +229,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
227229
]]></format>
228230
</remarks>
229231
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
230-
232+
231233
-or-
232234

233235
<typeparamref name="TValue" /> is not compatible with the JSON.
234236

235237
-or-
236238

237239
There is remaining data in the span beyond a single JSON value.</exception>
240+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <typeparamref name="TValue"/> or its serializable members.</exception>
238241
</Docs>
239242
</Member>
240243
<Member MemberName="Deserialize&lt;TValue&gt;">
@@ -280,14 +283,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
280283
<exception cref="T:System.ArgumentNullException">
281284
<paramref name="json" /> is <see langword="null" />.</exception>
282285
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
283-
286+
284287
-or-
285288

286289
<typeparamref name="TValue" /> is not compatible with the JSON.
287290

288291
-or-
289292

290293
There is remaining data in the string beyond a single JSON value.</exception>
294+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <typeparamref name="TValue"/> or its serializable members.</exception>
291295
</Docs>
292296
</Member>
293297
<Member MemberName="Deserialize&lt;TValue&gt;">
@@ -337,7 +341,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
337341
]]></format>
338342
</remarks>
339343
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
340-
344+
341345
-or-
342346

343347
<typeparamref name="TValue" /> is not compatible with the JSON.
@@ -347,6 +351,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
347351
A value could not be read from the reader.</exception>
348352
<exception cref="T:System.ArgumentException">
349353
<paramref name="reader" /> uses unsupported options.</exception>
354+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <typeparamref name="TValue"/> or its serializable members.</exception>
350355
</Docs>
351356
</Member>
352357
<Member MemberName="DeserializeAsync">
@@ -390,14 +395,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
390395
<exception cref="T:System.ArgumentNullException">
391396
<paramref name="utf8Json" /> or <paramref name="returnType" /> is <see langword="null" />.</exception>
392397
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
393-
398+
394399
-or-
395400

396401
<typeparamref name="TValue" /> is not compatible with the JSON.
397402

398403
-or-
399404

400405
There is remaining data in the stream.</exception>
406+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="returnType"/> or its serializable members.</exception>
401407
</Docs>
402408
</Member>
403409
<Member MemberName="DeserializeAsync&lt;TValue&gt;">
@@ -441,14 +447,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
441447
]]></format>
442448
</remarks>
443449
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
444-
450+
445451
-or-
446452

447453
<typeparamref name="TValue" /> is not compatible with the JSON.
448454

449455
-or-
450456

451457
There is remaining data in the stream.</exception>
458+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <typeparamref name="TValue"/> or its serializable members.</exception>
452459
</Docs>
453460
</Member>
454461
<Member MemberName="Serialize">
@@ -489,6 +496,9 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
489496
490497
]]></format>
491498
</remarks>
499+
<exception cref="T:System.ArgumentException"><paramref name="inputType"/> is not compatible with <paramref name="value"/>.</exception>
500+
<exception cref="T:System.ArgumentNullException"><paramref name="inputType" /> is <see langword="null" />.</exception>
501+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="inputType"/> or its serializable members.</exception>
492502
</Docs>
493503
</Member>
494504
<Member MemberName="Serialize">
@@ -530,8 +540,10 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
530540
531541
]]></format>
532542
</remarks>
543+
<exception cref="T:System.ArgumentException"><paramref name="inputType"/> is not compatible with <paramref name="value"/></exception>
533544
<exception cref="T:System.ArgumentNullException">
534-
<paramref name="writer" /> is <see langword="null" />.</exception>
545+
<paramref name="writer" /> or <paramref name="inputType" /> is <see langword="null" />.</exception>
546+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="inputType"/> or its serializable members.</exception>
535547
</Docs>
536548
</Member>
537549
<Member MemberName="Serialize&lt;TValue&gt;">
@@ -574,6 +586,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
574586
575587
]]></format>
576588
</remarks>
589+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <typeparamref name="TValue"/> or its serializable members.</exception>
577590
</Docs>
578591
</Member>
579592
<Member MemberName="Serialize&lt;TValue&gt;">
@@ -619,6 +632,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
619632
</remarks>
620633
<exception cref="T:System.ArgumentNullException">
621634
<paramref name="writer" /> is <see langword="null" />.</exception>
635+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <typeparamref name="TValue"/> or its serializable members.</exception>
622636
</Docs>
623637
</Member>
624638
<Member MemberName="SerializeAsync">
@@ -661,8 +675,10 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
661675
662676
]]></format>
663677
</remarks>
678+
<exception cref="T:System.ArgumentException"><paramref name="inputType"/> is not compatible with <paramref name="value"/>.</exception>
664679
<exception cref="T:System.ArgumentNullException">
665680
<paramref name="utf8Json" /> or <paramref name="inputType" /> is <see langword="null" />.</exception>
681+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="inputType"/> or its serializable members.</exception>
666682
</Docs>
667683
</Member>
668684
<Member MemberName="SerializeAsync&lt;TValue&gt;">
@@ -709,6 +725,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
709725
</remarks>
710726
<exception cref="T:System.ArgumentNullException">
711727
<paramref name="utf8Json" /> is <see langword="null" />.</exception>
728+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <typeparamref name="TValue"/> or its serializable members.</exception>
712729
</Docs>
713730
</Member>
714731
<Member MemberName="SerializeToUtf8Bytes">
@@ -747,6 +764,9 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
747764
748765
]]></format>
749766
</remarks>
767+
<exception cref="T:System.ArgumentException"><paramref name="inputType"/> is not compatible with <paramref name="value"/>.</exception>
768+
<exception cref="T:System.ArgumentNullException"><paramref name="inputType" /> is <see langword="null" />.</exception>
769+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="inputType"/> or its serializable members.</exception>
750770
</Docs>
751771
</Member>
752772
<Member MemberName="SerializeToUtf8Bytes&lt;TValue&gt;">
@@ -787,6 +807,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
787807
788808
]]></format>
789809
</remarks>
810+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <typeparamref name="TValue"/> or its serializable members.</exception>
790811
</Docs>
791812
</Member>
792813
</Members>

xml/System.Text.Json/JsonSerializerOptions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
254254
255255
]]></format>
256256
</remarks>
257+
<exception cref="T:System.InvalidOperationException">The configured <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="typeToConvert"/> returned an invalid converter.</exception>
258+
<exception cref="T:System.NotSupportedException">There is no compatible <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="typeToConvert"/> or its serializable members.</exception>
257259
</Docs>
258260
</Member>
259261
<Member MemberName="IgnoreNullValues">

0 commit comments

Comments
 (0)