-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add docs for diagnostics emitted by the System.Text.Json source generator #27163
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
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
43bad08
Add docs for diagnostics emitted by the System.Text.Json source gener…
layomia bd3d8fa
Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md
layomia 3e556e0
Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md
layomia 464015c
Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md
layomia d28c731
Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md
layomia ba6adb7
Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md
layomia 4ed36f6
Update docs/fundamentals/syslib-diagnostics/syslib1038.md
layomia 3e13831
Update docs/fundamentals/syslib-diagnostics/syslib1032.md
layomia 09b8a85
Update docs/fundamentals/syslib-diagnostics/source-generator-overview.md
layomia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 which is not partial, or whose containing type(s) is not partial. | ||
layomia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Workarounds | ||
|
|
||
| Make the context type and all containing types partial. | ||
|
|
||
| [!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 annotated with `[JsonInclude]` but with accessors that are inaccessible to the source generator, i.e. that are not `public` or `internal`. | ||
layomia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## 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)] | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.