Repository navigation
Use base accessors for unannotated setter-only JSON overrides - #136798
Closed
RutulPatel8 wants to merge 1 commit into
Closed
RutulPatel8 wants to merge 1 commit into
RutulPatel8 wants to merge 1 commit into
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-text-json |
This was referenced Nov 1, 2026
Member
|
Thanks, but I would rather we didn't take this change. The virtual member handling logic has historically been very sensitive to introducing important breaking changes and is also the source of many bugs. Any attempt to touch this code should look at addressing all issues addressed in #73255 holistically, including potentially exploring possible intentional breaking changes. |
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.
Fixes #96996
A setter-only property override has no getter in its own metadata. Both the reflection resolver and source generator selected that override and lost the public getter supplied by the base property, so serialization omitted it.
For unannotated setter-only overrides, let the base property supply the contract. Its virtual setter still dispatches to the override, while its getter remains available for serialization. Explicit attributes on an override continue to be processed as before.
Add a regression covering serialization and deserialization with both reflection and a generated context.
Validation: targeted regression passed; 206
PropertyVisibilityTestsDynamiccases and 62JsonSerializerContextTestscases passed on net481.