-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs for diagnostics emitted by the System.Text.Json source gener…
…ator (#27163) * Add docs for diagnostics emitted by the System.Text.Json source generator * Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Update docs/fundamentals/syslib-diagnostics/syslib1038.md Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Update docs/fundamentals/syslib-diagnostics/syslib1032.md Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> Co-authored-by: Tom Dykstra <tdykstra@microsoft.com>
- Loading branch information
Showing
9 changed files
with
134 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: SYSLIB1030 warning | ||
description: Learn about the diagnostic that generates compile-time warning SYSLIB1030. | ||
ms.date: 05/07/2021 | ||
--- | ||
|
||
# SYSLIB1030: `System.Text.Json` source generator did not generate output for type | ||
|
||
The `System.Text.Json` source generator did not generate output for a given type in the input object graph. This typically means that the type is not supported by `JsonSerializer`, for example multi-dimensional arrays like `int[,]`. | ||
|
||
## Workarounds | ||
|
||
Register a [custom converter](../../standard/serialization/system-text-json-converters-how-to.md) for the type. | ||
|
||
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: SYSLIB1031 warning | ||
description: Learn about the diagnostic that generates compile-time warning SYSLIB1031. | ||
ms.date: 05/07/2021 | ||
--- | ||
|
||
# SYSLIB1031: `System.Text.Json` source generator encountered a duplicate type info property name | ||
|
||
The `System.Text.Json` source generator encountered a duplicate type info property name to be generated on the specified partial context type. | ||
|
||
## Workarounds | ||
|
||
Specify a new type info property name for the duplicate instance using `System.Text.Json.Serialization.JsonSerializableAttribute.TypeInfoPropertyName`. | ||
|
||
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: SYSLIB1032 error | ||
description: Learn about the diagnostic that generates compile-time warning SYSLIB1032. | ||
ms.date: 05/07/2021 | ||
--- | ||
|
||
# SYSLIB1032: Context classes to be augmented by the `System.Text.Json` source generator must be declared as partial | ||
|
||
The `System.Text.Json` source generator encountered a context type included for source generation that is not partial, or whose containing type(s) is not partial. | ||
|
||
## Workarounds | ||
|
||
Make the context type and all containing types partial. | ||
|
||
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: SYSLIB1033 error | ||
description: Learn about the diagnostic that generates compile-time error SYSLIB1033. | ||
ms.date: 05/07/2021 | ||
--- | ||
|
||
# SYSLIB1033: `System.Text.Json` source generator encountered a type with multiple `[JsonConstructor]` annotations | ||
|
||
The `System.Text.Json` source generator encountered a serializable type with multiple `[JsonConstructor]` annotations. | ||
|
||
## Workarounds | ||
|
||
Remove duplicate `[JsonConstructor]` annotations. | ||
|
||
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: SYSLIB1035 error | ||
description: Learn about the diagnostic that generates compile-time error SYSLIB1035. | ||
ms.date: 05/07/2021 | ||
--- | ||
|
||
# SYSLIB1035: `System.Text.Json` source generator encountered a type with multiple `[JsonExtensionData]` annotations | ||
|
||
The `System.Text.Json` source generator encountered a serializable type with multiple `[JsonExtensionData]` annotations. | ||
|
||
## Workarounds | ||
|
||
Remove duplicate `[JsonExtensionData]` annotations. | ||
|
||
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: SYSLIB1036 error | ||
description: Learn about the diagnostic that generates compile-time error SYSLIB1036. | ||
ms.date: 05/07/2021 | ||
--- | ||
|
||
# SYSLIB1036: `System.Text.Json` source generator encountered an invalid `[JsonExtensionData]` annotation | ||
|
||
The `System.Text.Json` source generator encountered a property or field annotated with `[JsonExtensionData]` but whose data type does not implement `IDictionary<string, JsonElement>`, `IDictionary<string, object>`, `IDictionary<string, JsonNode>`, or `JsonNode`. | ||
|
||
## Workarounds | ||
|
||
Ensure that the data type for any property or field that is annotated with `[JsonExtensionData]` implements `IDictionary<string, JsonElement>`, `IDictionary<string, object>`, `IDictionary<string, JsonNode>`, or `JsonNode`. | ||
|
||
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: SYSLIB1037 warning | ||
description: Learn about the diagnostic that generates compile-time warning SYSLIB1037. | ||
ms.date: 05/07/2021 | ||
--- | ||
|
||
# SYSLIB1037: `System.Text.Json` source generator encountered a type with init-only properties which are not supported for deserialization | ||
|
||
The `System.Text.Json` source generator encountered a type with init-only properties, such as a record type. These properties are currently not supported by the source generator for deserialization. | ||
|
||
## Workarounds | ||
|
||
If deserialization of init-only properties is required, use the [reflection-based `JsonSerializer` implementation](../../standard/serialization/system-text-json-source-generation-modes.md). | ||
|
||
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: SYSLIB1038 warning | ||
description: Learn about the diagnostic that generates compile-time warning SYSLIB1038. | ||
ms.date: 05/07/2021 | ||
--- | ||
|
||
# SYSLIB1038: `System.Text.Json` source generator encountered a property annotated with `[JsonInclude]` but with inaccessible accessors | ||
|
||
The `System.Text.Json` source generator encountered a property that is annotated with `[JsonInclude]` but has accessors that are inaccessible to the source generator. The property must have `public` or `internal` accessors. | ||
|
||
## Workarounds | ||
|
||
If serialization or deserialization of properties with accessors that are not `public` or `internal` is required, use the [reflection-based `JsonSerializer` implementation](../../standard/serialization/system-text-json-source-generation-modes.md). | ||
|
||
[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] |