-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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/7.0] Fix configuration binding with types implementing IDictionary<,> #79019
Conversation
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsBackport of #78946 to release/7.0 /cc @tarekgh Customer ImpactThis issue is reported by the app-compat runs when running mixcore/mix.core app. The app will throw TestingI have tested the exact code used to repro the issue with the app-compat run with referencing the packages RiskMedium, touching configuration code comes with some risk but I tried my best testing the change to ensure will not cause any other regressions.
|
It's missing the OOB package authoring changes. I'll add them. |
Thanks @carlossanlop for adding OOB authoring change. |
This is approved offline by the email. |
runtime-staging not required, and passed in the previous run. |
Fixes #78938
Backport of #78946 to release/7.0
/cc @tarekgh
Customer Impact
This issue is reported by the app-compat runs when running mixcore/mix.core app. The app will throw
System.Reflection.AmbiguousMatchException
during the configuration binding. This is a regression from the fix #78118 we had in7.0.1
servicing. This problem occur only if the app is using a type implementingIDictionary<,>
and include members with the same names asIDictionary<,>
members. Like class indexerthis[]
orTryGetValue
method. When using such class with the configuration, we use the reflection to bind to such class using the type indexer andTryGetValue
method. If there is multiple members with the same name, the reflection will throwAmbiguousMatchException
.Testing
I have tested the exact code used to repro the issue with the app-compat run with referencing the packages
Quartz.AspNetCore v3.3.3
andQuartz.Extensions.DependencyInjection v3.3.3
which causing the problem. I have run all our tests against the fix which is covering all cases we fixed before to ensure no other regressions. Also, I have added extra test to catch the issue we are fixing here.Risk
Medium, touching configuration code comes with some risk but I tried my best testing the change to ensure will not cause any other regressions.