Skip to content

[release/10.0-preview7] New JsonValue derived class for JSON primitives #117917

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

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jul 22, 2025

Backport of #116798 to release/10.0-preview7

/cc @PranavSenthilnathan

Customer Impact

  • Customer reported
  • Found internally

When users call JsonValue.GetValue<T> or JsonValue.TryGetValue<T>, the call could fail due to being unable to convert the underlying type of the JsonValue to T. This was caught through Compat Lab testing for preview 6 and they filed this issue for it: #116730. In their repro, they were trying to convert to Guid. This PR fixes the issue by using the same conversion logic that we use in JsonValueOfElement like we did before the regression.

Regression

  • Yes
  • No

This was introduced when #115856 was added. In that PR a new approach to creating primitive values was introduced but the JsonValues that were created were not convertible via GetValue/TryGetValue.

Testing

The reported test case was added as a unit test and passes. The unit test coverage was expanded to fully cover the new code path.

Risk

Low. The fix uses the same conversion logic that we used prior to the regression. This is found here:

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.

@PranavSenthilnathan
Copy link
Member

/cc @jeffhandley @eiriktsarpalis

@danmoseley danmoseley added the Servicing-approved Approved for servicing release label Jul 22, 2025
@tarekgh tarekgh added this to the 10.0.0 milestone Jul 22, 2025
Copy link
Contributor

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

@tarekgh
Copy link
Member

tarekgh commented Jul 22, 2025

The ILink failure should be already fixed by #117916

@tarekgh
Copy link
Member

tarekgh commented Jul 22, 2025

/ba-g the ILink failure should be already fixed by #117916

@ericstj ericstj merged commit a039429 into release/10.0-preview7 Jul 22, 2025
88 of 96 checks passed
@jkotas jkotas deleted the backport/pr-116798-to-release/10.0-preview7 branch July 26, 2025 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Text.Json Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants