Skip to content

Commit 7dfda99

Browse files
authored
Merge pull request dotnet#4953 from gewarren/deserialize
Exception changes for Deserialize<char>
2 parents 5dbed8d + 8a218dd commit 7dfda99

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

xml/System.Text.Json/JsonSerializer.xml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ For more information, see [How to serialize and deserialize JSON](/dotnet/standa
136136
<exception cref="T:System.ArgumentNullException">
137137
<paramref name="json" /> or <paramref name="returnType" /> is <see langword="null" />.</exception>
138138
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
139-
139+
140140
-or-
141141

142142
<typeparamref name="TValue" /> is not compatible with the JSON.
@@ -201,7 +201,7 @@ For more information, see [How to serialize and deserialize JSON](/dotnet/standa
201201
<exception cref="T:System.ArgumentNullException">
202202
<paramref name="returnType" /> is <see langword="null" />.</exception>
203203
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
204-
204+
205205
-or-
206206

207207
<typeparamref name="returnType" /> is not compatible with the JSON.
@@ -306,6 +306,8 @@ For more information, see [How to serialize and deserialize JSON](/dotnet/standa
306306
307307
]]></format>
308308
</remarks>
309+
<exception cref="T:System.IndexOutOfRangeException">
310+
.NET Core 3.0 only: <typeparamref name="TValue" /> is <see cref="T:System.Char" /> and <paramref name="json" /> is an empty string.</exception>
309311
<exception cref="T:System.ArgumentNullException">
310312
<paramref name="json" /> is <see langword="null" />.</exception>
311313
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.
@@ -316,7 +318,11 @@ For more information, see [How to serialize and deserialize JSON](/dotnet/standa
316318

317319
-or-
318320

319-
There is remaining data in the string beyond a single JSON value.</exception>
321+
There is remaining data in the string beyond a single JSON value.
322+
323+
-or-
324+
325+
.NET Core 3.1 and later versions only: <typeparamref name="TValue" /> is <see cref="T:System.Char" /> and <paramref name="json" /> is a null reference (<code>JsonSerializer.Deserialize&lt;char&gt;("null");</code>) or an empty string.</exception>
320326
<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>
321327
</Docs>
322328
</Member>
@@ -355,15 +361,15 @@ There is remaining data in the string beyond a single JSON value.</exception>
355361
## Remarks
356362
357363
If the <xref:System.Text.Json.Utf8JsonReader.TokenType> property of `reader` is <xref:System.Text.Json.JsonTokenType.PropertyName?displayProperty=nameWithType> or <xref:System.Text.Json.JsonTokenType.None?displayProperty=nameWithType>, the reader will be advanced by one call to <xref:System.Text.Json.Utf8JsonReader.Read?displayProperty=nameWithType> to determine the start of the value.
358-
364+
359365
Upon completion of this method, `reader` will be positioned at the final token in the JSON value. If an exception is thrown, the reader is reset to the state it was in when the method was called.
360-
366+
361367
This method makes a copy of the data the reader acted on, so there is no caller requirement to maintain data integrity beyond the return of this method.
362-
368+
363369
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.
364370
365371
For more information, see [How to serialize and deserialize JSON](/dotnet/standard/serialization/system-text-json-how-to).
366-
372+
367373
]]></format>
368374
</remarks>
369375
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.

0 commit comments

Comments
 (0)