-
Notifications
You must be signed in to change notification settings - Fork 5k
[release/8.0-staging] Fix literal formatting in source generators #94070
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
[release/8.0-staging] Fix literal formatting in source generators #94070
Conversation
Both ConfigurationBinder and Json were not handling decimal values correctly. This shares and updates our workaround method for formatting these.
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsBackport of #93160 to release/8.0-staging /cc @ericstj Customer ImpactTestingRiskIMPORTANT: If this backport is for a servicing release, please verify that:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I assume you'll add the package authoring change.
src/libraries/System.Text.Json/tests/Common/TestClasses/TestClasses.Constructor.cs
Show resolved
Hide resolved
… into backport/pr-93160-to-release/8.0-staging
* Add a baseline test for constructor parameters * Fix binding types with optional string parameters Ensure the source generator emits the declaration with default value for all cases when we emit the bind logic. * Add a test case that uses a Primary Constructor with default values * Split baseline data for added test. * Fix .NETFramework test baseline * Update baselines after global namespace change # Conflicts:
Ok, I ported the handling for string parameters too. Can I get another review? FYI @artl93 we want to bring this for servicing. |
Need to merge latest due to global:: change going in. |
… into backport/pr-93160-to-release/8.0-staging
Approved over email |
Backport of #93160 to release/8.0-staging
/cc @ericstj
Customer Impact
Cannot use ConfigurationBinder source generator when a configuration type has a constructor with optional parameters of type Enum, Decimal, or string. Generator produces code which doesn't compile.
Testing
Automated tests added to cover types usable in of optional parameters. Baseline tests added as well to track the code-generation for these scenarios.
Risk
Low. Only touches Configuration & Json source generators and reuses a method that was already working in JSON.
Package versioning was done in #94307