Uh oh!
There was an error while loading. Please reload this page.
Prefer most derived member in Configuration Binder source generator - #101316
Conversation
Tagging subscribers to this area: @dotnet/area-extensions-configuration |
Uh oh!
There was an error while loading. Please reload this page.
eerhardt
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the quick fix here!
Do you think this could be backported to 8.0.x?
Uh oh!
There was an error while loading. Please reload this page.
eiriktsarpalis
left a comment
There was a problem hiding this comment.
Per #101316 (review) I suspect that this might be introducing a slight regression.
Given that this is a likely candidate for backporting, it might make sense to investigate further.
ericstj
commented
Apr 22, 2024
I'll add a test case for an override that only overrides the Getter. We did have a test for the case where a |
ericstj
commented
Apr 22, 2024
Seems we still have a failure of the Reflection binder: @eerhardt -- does that sound right? That seems to indicate that #101273 might be broken even without the source generator. |
ericstj
commented
Apr 22, 2024
Interesting: the reflection binder has a different heuristic. It never does any resolution by name, but builds a list in order from derived to base. So it will set both the hidden and non-hidden members through reflection, using the same configuration data. That's unusual behavior - but we could replicate it if we casted the LHS in the source generator to the base type. |
tarekgh
commented
Apr 22, 2024
@ericstj I think we need to keep the runtime behavior for consistency. Even if it looks unusual behavior but seems not many people complained about it. |
eerhardt
commented
Apr 22, 2024
See my comment on #101273 (comment). For the case I hit the issue, the base enum is a superset of the derived enum. The derived class is trying to limit which values can be set. |
Do we want to? Are there tests validating this behavior? |
I'm not planning to change the reflection binder's behavior in this PR. Nor am I planning to change the source generator to bind many different propreties like the reflection binder does. I'm inclined to more closely match the reflection-binder's selection algorithm for finding the most-derived property. I think that will be the minimal change while unblocking @eerhardt. I'm running some tests and will make a new change to this PR shortly. |
ericstj
commented
Apr 29, 2024
Failures are known issues and don't block build or testing. |
ericstj
commented
Apr 29, 2024
/backport to release/8.0-staging |
Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/8881506956 |
…otnet#101316) * Prefer most derived member in Configuration Binder source generator * Skip overridden properties in config source generator - include only definitions
…otnet#101316) * Prefer most derived member in Configuration Binder source generator * Skip overridden properties in config source generator - include only definitions
…otnet#101316) * Prefer most derived member in Configuration Binder source generator * Skip overridden properties in config source generator - include only definitions
Fix#101267#101273
CC @eerhardt