-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[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
ericstj
merged 12 commits into
release/10.0-preview7
from
backport/pr-116798-to-release/10.0-preview7
Jul 22, 2025
Merged
[release/10.0-preview7] New JsonValue derived class for JSON primitives #117917
ericstj
merged 12 commits into
release/10.0-preview7
from
backport/pr-116798-to-release/10.0-preview7
Jul 22, 2025
Conversation
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
Contributor
This reverts commit 30ca4ab.
jeffhandley
approved these changes
Jul 22, 2025
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
The ILink failure should be already fixed by #117916 |
/ba-g the ILink failure should be already fixed by #117916 |
ericstj
approved these changes
Jul 22, 2025
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.
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 theJsonValue
toT
. 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 inJsonValueOfElement
like 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
JsonValue
s 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
.