Skip to content
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

JsonDocument is not thread safe #31508

Merged
merged 2 commits into from
Sep 30, 2022
Merged
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
19 changes: 1 addition & 18 deletions docs/standard/serialization/system-text-json/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,7 @@ For information about security threats that were considered when designing <xref

## Thread safety

The `System.Text.Json` types are thread-safe, including:

:::zone pivot="dotnet-5-0,dotnet-core-3-1"

* <xref:System.Text.Json.JsonSerializer>
* <xref:System.Text.Json.Utf8JsonReader>
* <xref:System.Text.Json.Utf8JsonWriter>
* <xref:System.Text.Json.JsonDocument>
:::zone-end

:::zone pivot="dotnet-7-0,dotnet-6-0"

* <xref:System.Text.Json.JsonSerializer>
* <xref:System.Text.Json.Utf8JsonReader>
* <xref:System.Text.Json.Utf8JsonWriter>
* <xref:System.Text.Json.JsonDocument>
* <xref:System.Text.Json.Nodes.JsonNode>
:::zone-end
The `System.Text.Json` serializer was designed with thread safety in mind. Practically, this means that once locked, <xref:System.Text.Json.JsonSerializerOptions> instances can be safely shared across multiple threads.

## Additional resources

Expand Down