Skip to content

[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

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 26, 2023

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

Both ConfigurationBinder and Json were not handling decimal values
correctly.  This shares and updates our workaround method for formatting
these.
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 26, 2023
@ericstj ericstj added area-Extensions-Configuration and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Oct 26, 2023
@ghost
Copy link

ghost commented Oct 26, 2023

Tagging subscribers to this area: @dotnet/area-extensions-configuration
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #93160 to release/8.0-staging

/cc @ericstj

Customer Impact

Testing

Risk

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-Extensions-Configuration, needs-area-label

Milestone: -

@ericstj ericstj changed the title [release/8.0-staging] Fix Decimal literal formatting in source generators [release/8.0-staging] Fix literal formatting in source generators Oct 26, 2023
@ericstj ericstj added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 26, 2023
@tarekgh tarekgh added this to the 8.0.1 milestone Oct 26, 2023
Copy link
Member

@tarekgh tarekgh left a 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.

… 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:
@ericstj ericstj added Servicing-consider Issue for next servicing release review and removed NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) labels Nov 7, 2023
@ericstj
Copy link
Member

ericstj commented Nov 7, 2023

Ok, I ported the handling for string parameters too. Can I get another review? FYI @artl93 we want to bring this for servicing.

@ericstj
Copy link
Member

ericstj commented Nov 7, 2023

Need to merge latest due to global:: change going in.

@ericstj ericstj added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Nov 8, 2023
@ericstj
Copy link
Member

ericstj commented Nov 8, 2023

Approved over email

@ericstj ericstj merged commit 213f1a2 into release/8.0-staging Nov 8, 2023
@akoeplinger akoeplinger deleted the backport/pr-93160-to-release/8.0-staging branch November 14, 2023 13:53
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants