Content-Length: 452080 | pFad | https://github.com/dotnet/runtime/pull/86365

24 Add support for types with parameterized ctors to config binder gen by layomia · Pull Request #86365 · dotnet/runtime · GitHub
Skip to content

Add support for types with parameterized ctors to config binder gen #86365

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 3 commits into from
May 26, 2023

Conversation

layomia
Copy link
Contributor

@layomia layomia commented May 17, 2023

This PR adds support for config types that are bound using parameterized ctors, required properties, and/or init-only properties.

@layomia layomia added this to the 8.0.0 milestone May 17, 2023
@layomia layomia self-assigned this May 17, 2023
@ghost
Copy link

ghost commented May 17, 2023

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

Issue Details

This PR adds initial support for config types that are bound using parameterized ctors, required properties, and/or init-only properties.

Needs a follow up to

  • sync exception handling and property-parameter matching with reflection implementation. Right now, partial binding may be done if properties & parameters do not match perfectly (but there are no compilation issues given the project tests).
  • issue diagnostic warnings where appropriate
Author: layomia
Assignees: layomia
Labels:

area-Extensions-Configuration

Milestone: 8.0.0

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.

Added a couple of comments please address them before merging.

@layomia layomia force-pushed the binder-gen-ctors branch 2 times, most recently from 8640d25 to 6cd9bf7 Compare May 17, 2023 21:29
@layomia layomia marked this pull request as draft May 17, 2023 22:57
@layomia
Copy link
Contributor Author

layomia commented May 17, 2023

Will request review again after addressing #86365 (comment).

@layomia layomia force-pushed the binder-gen-ctors branch 2 times, most recently from b5bf629 to 3b4c0b6 Compare May 25, 2023 11:33
@layomia layomia force-pushed the binder-gen-ctors branch from 3b4c0b6 to 3fd46fd Compare May 25, 2023 11:36
@layomia layomia requested a review from tarekgh May 25, 2023 11:43
@layomia layomia requested a review from eiriktsarpalis May 25, 2023 11:43
@layomia layomia marked this pull request as ready for review May 25, 2023 11:43
@layomia
Copy link
Contributor Author

layomia commented May 25, 2023

Implementation is now in sync with reflection; including exception handling, parameter-property binding... PTAL.

@tarekgh
Copy link
Member

tarekgh commented May 25, 2023

    public void ExceptionWhenTryingToBindClassWithoutParameterlessConstructor()

this test cannot be enabled for source gen now?


Refers to: src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs:907 in 3fd46fd. [](commit_id = 3fd46fd, deletion_comment = False)

@layomia
Copy link
Contributor Author

layomia commented May 25, 2023

    public void ExceptionWhenTryingToBindClassWithoutParameterlessConstructor()

this test cannot be enabled for source gen now?

Refers to: src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs:907 in 3fd46fd. [](commit_id = 3fd46fd, deletion_comment = False)

Missed that, thanks. It passes.

@layomia layomia merged commit 93c8be6 into dotnet:main May 26, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 26, 2023
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.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/dotnet/runtime/pull/86365

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy