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

[release/8.0] Throw when applying JsonObjectHandling.Populate to types with parameterized constructors. #92947

Merged
merged 3 commits into from Oct 4, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 3, 2023

Backport of #92937 to release/8.0

/cc @eiriktsarpalis

Customer Impact

We received a customer report that the newly added JsonObjectCreationHandling feature (aka "populate read-only members") does not behave as expected when applied to types that deserialize using parameterized constructors. On closer inspection it turned out fixing the feature for that particular use case would necessitate substantial refactoring of async serialization code, something that is too risky/time consuming to do at this stage. Instead, this PR adds checks and throws an explicit exception when users attempt to use the feature on types with parameterized constructors.

Testing

Added unit testing validating the throwing behavior.

Risk

Low. Adds additional validation to product code to block the unsupported scenario.

@ghost
Copy link

ghost commented Oct 3, 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

Backport of #92937 to release/8.0

/cc @eiriktsarpalis

Customer Impact

Testing

Risk

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@eiriktsarpalis eiriktsarpalis self-assigned this Oct 3, 2023
@eiriktsarpalis eiriktsarpalis added this to the 8.0.0 milestone Oct 3, 2023
@eiriktsarpalis eiriktsarpalis added the Servicing-consider Issue for next servicing release review label Oct 3, 2023
@eiriktsarpalis eiriktsarpalis assigned artl93 and unassigned artl93 Oct 3, 2023
@artl93
Copy link
Contributor

artl93 commented Oct 3, 2023

@eiriktsarpalis - is this something we'd want to change later to add parameterized constructor support? (e.g. 9.0, servicing, never?)

@jeffhandley
Copy link
Member

jeffhandley commented Oct 3, 2023

@eiriktsarpalis - is this something we'd want to change later to add parameterized constructor support? (e.g. 9.0, servicing, never?)

We are leaving it in the backlog (#92877) as something we will consider adding support for in .NET 9+. We would not bring it for servicing though.

@carlossanlop carlossanlop added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 3, 2023
@carlossanlop
Copy link
Member

Approved by Tactics via email.

@carlossanlop carlossanlop merged commit 1954c37 into release/8.0 Oct 4, 2023
106 of 110 checks passed
@carlossanlop carlossanlop deleted the backport/pr-92937-to-release/8.0 branch October 4, 2023 01:38
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants