Skip to content

[release/9.0-preview5] Fix STJ support for System.Reflection.NullabilityInfoContext.IsSupported = false #102876

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 May 30, 2024

Backport of #102852 to release/9.0-preview5

/cc @eiriktsarpalis

Customer Impact

.NET 9 Preview 5 added support for nullable reference types in System.Text.Json via #102499. The reflection-based serializer uses the System.Reflection.NullabilityInfoContext class to derive this metadata. What this change didn't anticipate is that NullabilityInfoContext can be disabled via a feature flag, and Blazor wasm disables that feature flag by default. This results in an exception being thrown every time Blazor wasm attempts to use JsonSerializer using the reflection-based serializer.

This PR adds checking for the NullabilityInfoContext feature flag so that the serializer can handle applications where the flag has been turned off.

Regression

Yes

Testing

Added unit testing covering the impacted scenario.

Risk

Low.

@eiriktsarpalis eiriktsarpalis added the Servicing-consider Issue for next servicing release review label May 30, 2024
@mmitche mmitche merged commit de6897b into release/9.0-preview5 May 30, 2024
80 of 88 checks passed
@lewing lewing deleted the backport/pr-102852-to-release/9.0-preview5 branch May 30, 2024 17:21
@lewing
Copy link
Member

lewing commented May 31, 2024

This wasn't working, I've described the problem here dotnet/sdk#41322 (comment)

@mkArtakMSFT mkArtakMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Jun 4, 2024
@mkArtakMSFT
Copy link

This was approved in Tactics.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2024
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.

6 participants