Skip to content

Conversation

@eiriktsarpalis
Copy link
Member

Fixes a race condition wherein the JsonSerializerOptions.CacheContext property could be returning multiple instances, which can occasionally make this assertion fail:

Debug.Assert(Monitor.IsEntered(Options.CacheContext), "Configure called directly, use EnsureConfigured which synchronizes access to this method");

Fix #88102.

@eiriktsarpalis eiriktsarpalis self-assigned this Nov 8, 2023
@ghost ghost added the area-System.Text.Json label Nov 8, 2023
@ghost
Copy link

ghost commented Nov 8, 2023

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes a race condition wherein the JsonSerializerOptions.CacheContext property could be returning multiple instances, which can occasionally make this assertion fail:

Debug.Assert(Monitor.IsEntered(Options.CacheContext), "Configure called directly, use EnsureConfigured which synchronizes access to this method");

Fix #88102.

Author: eiriktsarpalis
Assignees: eiriktsarpalis
Labels:

area-System.Text.Json

Milestone: -

@eiriktsarpalis eiriktsarpalis added this to the 9.0.0 milestone Nov 8, 2023
@eiriktsarpalis eiriktsarpalis merged commit 57fd56a into dotnet:main Nov 15, 2023
@eiriktsarpalis eiriktsarpalis deleted the fix-cachingcontext-uniqueness branch November 15, 2023 18:27
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native crash on System.Text.Json.SourceGeneration.Roslyn4.4.Tests net8.0-linux-Debug-arm64-Mono_release

2 participants