Skip to content
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

Subject src-gen serializer to full number-handling test #87484

Merged
merged 5 commits into from Jun 13, 2023

Conversation

eiriktsarpalis
Copy link
Member

@eiriktsarpalis eiriktsarpalis commented Jun 13, 2023

Revives #78010

Fixes #58638. Fixes #79511. Contributes to #73714.

@ghost
Copy link

ghost commented Jun 13, 2023

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

Issue Details

Revives #78010

Fixes #58638. Contributes to #73714.

Author: eiriktsarpalis
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@eiriktsarpalis eiriktsarpalis added this to the 8.0.0 milestone Jun 13, 2023
@@ -104,8 +109,7 @@ public bool IsFastPathSupported()
foreach (PropertyGenerationSpec property in PropertyGenSpecs)
{
if (property.PropertyType.SpecialType is SpecialType.System_Object ||
property.NumberHandling is JsonNumberHandling.AllowNamedFloatingPointLiterals
or JsonNumberHandling.WriteAsString ||
property.NumberHandling != null ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the same check for type infos apply here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's causing test failures for cases where you have properties containing POCOs annotated with JsonNumberHandling.Strict and you have global configuration specifying WriteAsString. The fast-path method cannot pass the property-level configuration to downlevel JsonSerializer.Serialize calls so it ends up picking up the global configuration incorrectly. Probably not a super common scenario but I figured we should be conservative for now.

@eiriktsarpalis eiriktsarpalis merged commit baceeb0 into dotnet:main Jun 13, 2023
99 of 105 checks passed
@eiriktsarpalis eiriktsarpalis deleted the number-handling branch June 13, 2023 21:10
@dotnet dotnet locked as resolved and limited conversation to collaborators Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants