[release/10.0-preview7] New JsonValue derived class for JSON primitives#117917
Merged
ericstj merged 12 commits intorelease/10.0-preview7from Jul 22, 2025
Merged
Conversation
This reverts commit 30ca4ab.
Member
jeffhandley
approved these changes
Jul 22, 2025
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
Member
|
The ILink failure should be already fixed by #117916 |
Member
|
/ba-g the ILink failure should be already fixed by #117916 |
ericstj
approved these changes
Jul 22, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Backport of #116798 to release/10.0-preview7
/cc @PranavSenthilnathan
Customer Impact
When users call
JsonValue.GetValue<T>orJsonValue.TryGetValue<T>, the call could fail due to being unable to convert the underlying type of theJsonValuetoT. 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 toGuid. This PR fixes the issue by using the same conversion logic that we use inJsonValueOfElementlike we did before the regression.Regression
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 viaGetValue/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:
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonValueOfElement.cs
Line 60 in b131b6d
IMPORTANT: If this backport is for a servicing release, please verify that:
release/X.0-staging, notrelease/X.0.