Skip to content

Fix Decimal literal formatting in source generators #93160

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
merged 2 commits into from
Oct 10, 2023

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Oct 7, 2023

Fixes #92773

Both ConfigurationBinder and Json were not handling decimal values correctly. This shares and updates our workaround method for formatting these.

Both ConfigurationBinder and Json were not handling decimal values
correctly.  This shares and updates our workaround method for formatting
these.
@ghost
Copy link

ghost commented Oct 7, 2023

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

Issue Details

Fixes #92773

Both ConfigurationBinder and Json were not handling decimal values correctly. This shares and updates our workaround method for formatting these.

Author: ericstj
Assignees: ericstj
Labels:

area-Extensions-Configuration

Milestone: -

{
if (value == null)
{
return $"default({type.FullyQualifiedName})";
Copy link
Member

Choose a reason for hiding this comment

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

Nit: wouldn't it be preferable to just use null for the case of nullable types?

Copy link
Member

Choose a reason for hiding this comment

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

I am seeing we used null before.

Copy link
Member Author

Choose a reason for hiding this comment

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

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.

I have left a couple of questions. LGTM otherwise.

@ericstj
Copy link
Member Author

ericstj commented Oct 26, 2023

We might need to service this. Looks like without this we cannot handle enums with default values which is a bit more common than decimal literals.

@ericstj
Copy link
Member Author

ericstj commented Oct 26, 2023

/backport to release/8.0-staging

@github-actions
Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/6660696766

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configuration Binding Generator Initializes Suffixed Default Values Incorrectly
4 participants