Revert System.Text.Json source generator changes from PR #124077#124186
Merged
eiriktsarpalis merged 5 commits intomainfrom Feb 11, 2026
Merged
Revert System.Text.Json source generator changes from PR #124077#124186eiriktsarpalis merged 5 commits intomainfrom
eiriktsarpalis merged 5 commits intomainfrom
Conversation
Restore the original pattern where KnownTypeSymbols is created via CompilationProvider to maintain 1-1 correspondence between Compilation and KnownTypeSymbols instances, avoiding performance regression. Co-authored-by: eiriktsarpalis <[email protected]>
tarekgh
approved these changes
Feb 9, 2026
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-text-json |
Copilot
AI
changed the title
[WIP] Revert System.Text.Json changes from LoggerMessageGenerator update
Revert System.Text.Json source generator changes from PR #124077
Feb 9, 2026
eiriktsarpalis
approved these changes
Feb 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reverts the System.Text.Json source generator pipeline change from PR #124077 to restore per-compilation caching of KnownTypeSymbols, avoiding redundant symbol resolution and the associated performance regression.
Changes:
- Reintroduced
context.CompilationProvider.Select(...)to create an incrementalKnownTypeSymbolsvalue cached perCompilation. - Restored the
.Combine(knownTypeSymbols).Select(...)pipeline shape so parsing uses the combined(SemanticModel, ContextClass)+ cachedKnownTypeSymbols. - Moved
KnownTypeSymbolsconstruction back out of theForAttributeWithMetadataNametransform.
This was referenced Feb 9, 2026
Member
|
/ba-g test failures unrelated |
Member
|
/ba-g test failures unrelated |
1 similar comment
Member
|
/ba-g test failures unrelated |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Reverts System.Text.Json changes from PR #124077 per @eiriktsarpalis feedback. The change caused a performance regression by breaking the 1-1 correspondence between
CompilationandKnownTypeSymbolsinstances, creating fresh instances for everyJsonSerializerContextinstead of caching per compilation.LoggerMessageGenerator changes remain unchanged.
Changes
Restored the original incremental pipeline pattern in
JsonSourceGenerator.Roslyn4.0.cs:Before (PR #124077):
After (this PR):
This ensures
KnownTypeSymbolsis cached per compilation in the incremental pipeline, eliminating redundant type symbol resolution.Testing
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.