-
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-rc2] Ensure Bind can handle null from GetSection #92477
[release/8.0-rc2] Ensure Bind can handle null from GetSection #92477
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-rc2 /cc @ericstj Customer ImpactTestingRiskIMPORTANT: If this backport is for a servicing release, please verify that:
|
M2 approved. |
Approved by Tactics via email. |
Thank you @carlossanlop |
Backport of #92384 to release/8.0-rc2
/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.