Skip to content

[release/9.0-staging] Fix case-insensitive JSON deserialization of enum member names - #112057

Merged
PranavSenthilnathan merged 4 commits into
release/9.0-stagingfrom
backport/pr-112028-to-release/9.0
Feb 19, 2025
Merged

[release/9.0-staging] Fix case-insensitive JSON deserialization of enum member names#112057
PranavSenthilnathan merged 4 commits into
release/9.0-stagingfrom
backport/pr-112028-to-release/9.0

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jan 31, 2025

Copy link
Copy Markdown
Contributor

Backport of #112028 to release/9.0-staging

/cc @eiriktsarpalis@PranavSenthilnathan

Customer Impact

  • Customer reported
  • Found internally

When deserializing a string into an enum using a naming policy, if the C# enum member name is the same as its name derived from the naming policy, then the deserialization will be case sensitive. This prevents some values from being deserialized successfully in .NET 9.0 which previously worked fine in .NET 8.0. Reported in #110745.

Regression

  • Yes
  • No

Introduced in #105032.

Testing

User scenario was validated manually and new unit tests have been added to cover it.

Risk

Low. This is a targeted change that fixes the handling of a corner case that got regressed in .NET 9.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

@jeffhandleyjeffhandley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the PR review is completed and the template is filled out, please apply the Servicing-considerIssue for next servicing release review label.

@PranavSenthilnathanPranavSenthilnathan added the Servicing-consider Issue for next servicing release review label Feb 3, 2025
@jeffhandley
jeffhandley changed the base branch from release/9.0 to release/9.0-stagingFebruary 4, 2025 18:11
@jeffhandley

Copy link
Copy Markdown
Member

@PranavSenthilnathan / @eiriktsarpalis -- I overlooked that this backport had been queued up against release/9.0 instead of release/9.0-staging. I just re-targeted it.

@jeffhandleyjeffhandley changed the title [release/9.0] Fix case-insensitive JSON deserialization of enum member names[release/9.0-staging] Fix case-insensitive JSON deserialization of enum member namesFeb 4, 2025
@rbhandarbhanda added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Feb 4, 2025
@rbhandarbhanda added this to the 9.0.3 milestone Feb 4, 2025
@carlossanlopcarlossanlop added Servicing-approved Approved for servicing release and removed Servicing-approved Approved for servicing release labels Feb 19, 2025
@PranavSenthilnathan
PranavSenthilnathan merged commit 33a0635 into release/9.0-stagingFeb 19, 2025
@PranavSenthilnathan
PranavSenthilnathan deleted the backport/pr-112028-to-release/9.0 branch February 19, 2025 00:44
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Mar 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Text.JsonServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@jeffhandley@PranavSenthilnathan@carlossanlop@rbhanda