-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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/8.0] Ensure Bind can handle null from GetSection #92450
Conversation
IConfiguration instances may return a null value from GetSection. We were not handling this and would throw a NullReferenceException.
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsBackport of #92384 to release/8.0 /cc @ericstj Customer ImpactTestingRiskIMPORTANT: If this backport is for a servicing release, please verify that:
|
@ericstj this is targeting release/8.0. Intended? We could try to get it in to RC2. |
I see - I was thinking it might be tight to get it in RC2 and this isn't a major blocker since our implementations of configuration will never return null - the interface itself is not annotated to return null. I'll open an RC2 PR which we can merge if it's ready in time and doesn't reset anything. Otherwise we'll use this one. |
Marked this as no-merge for now. We'll only use this PR if we decide not to take in RC2. |
The RC2 PR was merged, so this will flow to RTM automatically. We can close this now. #92477 |
Thanks @carlossanlop |
Backport of #92384 to release/8.0
/cc @ericstj
Customer Impact
NullReferenceException when an IConfiguration instance returns
null
fromGetSection
. No implementations in the product do this, and the interface is not annotated to return null, however we received a customer report of this regression from mocking the interface. When usingmoq
to mock an interface it will return null for unspecified cases.Testing
Tested customer reported case manually using Moq. Added automated test for both runtime binder and source gen to catch this behavior.
Risk
Very low - we are only adding back a null check that was removed from a previous change in RC2.