Skip to content

Add missing exceptions to JsonSerializer and JsonSerializerOptions #3989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions xml/System.Text.Json/JsonSerializer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
<exception cref="T:System.ArgumentNullException">
<paramref name="returnType" /> is <see langword="null" />.</exception>
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.

-or-

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

-or-

There is remaining data in the span beyond a single JSON value.</exception>
<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>
</Docs>
</Member>
<Member MemberName="Deserialize">
Expand Down Expand Up @@ -124,6 +125,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
-or-

There is remaining data in the string beyond a single JSON value.</exception>
<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>
</Docs>
</Member>
<Member MemberName="Deserialize">
Expand Down Expand Up @@ -166,7 +168,6 @@ This method makes a copy of the data the reader acted on, so there is no caller
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.

For more information, see [How to serialize and deserialize JSON](~/docs/standard/serialization/system-text-json-how-to.md).

]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
Expand All @@ -182,6 +183,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
A value could not be read from the reader.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="reader" /> is using unsupported options.</exception>
<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>
</Docs>
</Member>
<Member MemberName="Deserialize&lt;TValue&gt;">
Expand Down Expand Up @@ -222,14 +224,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
]]></format>
</remarks>
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.

-or-

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

-or-

There is remaining data in the span beyond a single JSON value.</exception>
<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>
</Docs>
</Member>
<Member MemberName="Deserialize&lt;TValue&gt;">
Expand Down Expand Up @@ -274,14 +277,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
<exception cref="T:System.ArgumentNullException">
<paramref name="json" /> is <see langword="null" />.</exception>
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.

-or-

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

-or-

There is remaining data in the string beyond a single JSON value.</exception>
<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>
</Docs>
</Member>
<Member MemberName="Deserialize&lt;TValue&gt;">
Expand Down Expand Up @@ -330,7 +334,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
]]></format>
</remarks>
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.

-or-

<typeparamref name="TValue" /> is not compatible with the JSON.
Expand All @@ -340,6 +344,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
A value could not be read from the reader.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="reader" /> uses unsupported options.</exception>
<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>
</Docs>
</Member>
<Member MemberName="DeserializeAsync">
Expand Down Expand Up @@ -382,14 +387,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
<exception cref="T:System.ArgumentNullException">
<paramref name="utf8Json" /> or <paramref name="returnType" /> is <see langword="null" />.</exception>
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.

-or-

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

-or-

There is remaining data in the stream.</exception>
<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>
</Docs>
</Member>
<Member MemberName="DeserializeAsync&lt;TValue&gt;">
Expand Down Expand Up @@ -432,14 +438,15 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
]]></format>
</remarks>
<exception cref="T:System.Text.Json.JsonException">The JSON is invalid.

-or-

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

-or-

There is remaining data in the stream.</exception>
<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>
</Docs>
</Member>
<Member MemberName="Serialize">
Expand Down Expand Up @@ -479,6 +486,9 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar

]]></format>
</remarks>
<exception cref="T:System.ArgumentException"><paramref name="inputType"/> is not compatible with <paramref name="value"/>.</exception>
<exception cref="T:System.ArgumentNullException"><paramref name="inputType" /> is <see langword="null" />.</exception>
<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>
</Docs>
</Member>
<Member MemberName="Serialize">
Expand Down Expand Up @@ -519,8 +529,10 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar

]]></format>
</remarks>
<exception cref="T:System.ArgumentException"><paramref name="inputType"/> is not compatible with <paramref name="value"/></exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="writer" /> is <see langword="null" />.</exception>
<paramref name="writer" /> or <paramref name="inputType" /> is <see langword="null" />.</exception>
<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>
</Docs>
</Member>
<Member MemberName="Serialize&lt;TValue&gt;">
Expand Down Expand Up @@ -562,6 +574,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar

]]></format>
</remarks>
<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>
</Docs>
</Member>
<Member MemberName="Serialize&lt;TValue&gt;">
Expand Down Expand Up @@ -606,6 +619,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="writer" /> is <see langword="null" />.</exception>
<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>
</Docs>
</Member>
<Member MemberName="SerializeAsync">
Expand Down Expand Up @@ -647,8 +661,10 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar

]]></format>
</remarks>
<exception cref="T:System.ArgumentException"><paramref name="inputType"/> is not compatible with <paramref name="value"/>.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="utf8Json" /> or <paramref name="inputType" /> is <see langword="null" />.</exception>
<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>
</Docs>
</Member>
<Member MemberName="SerializeAsync&lt;TValue&gt;">
Expand Down Expand Up @@ -694,6 +710,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="utf8Json" /> is <see langword="null" />.</exception>
<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>
</Docs>
</Member>
<Member MemberName="SerializeToUtf8Bytes">
Expand Down Expand Up @@ -731,6 +748,9 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar

]]></format>
</remarks>
<exception cref="T:System.ArgumentException"><paramref name="inputType"/> is not compatible with <paramref name="value"/>.</exception>
<exception cref="T:System.ArgumentNullException"><paramref name="inputType" /> is <see langword="null" />.</exception>
<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>
</Docs>
</Member>
<Member MemberName="SerializeToUtf8Bytes&lt;TValue&gt;">
Expand Down Expand Up @@ -770,6 +790,7 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar

]]></format>
</remarks>
<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>
</Docs>
</Member>
</Members>
Expand Down
2 changes: 2 additions & 0 deletions xml/System.Text.Json/JsonSerializerOptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ For more information, see [How to serialize and deserialize JSON](~/docs/standar

]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The configured <see cref="System.Text.Json.Serialization.JsonConverter"/> for <paramref name="typeToConvert"/> returned an invalid converter.</exception>
<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>
</Docs>
</Member>
<Member MemberName="IgnoreNullValues">
Expand Down