-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix config source gen with Dictionary with nullable Enum value #115350
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
Fix config source gen with Dictionary with nullable Enum value #115350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses the issue with configuration source generation for dictionaries that have nullable enum values. The changes include adding a new test to verify this behavior, introducing supporting test classes and enums, and updating the code generation logic to unwrap nullable types correctly.
- Added new test case in ConfigurationBinderTests.cs to verify dictionary binding with nullable enum values
- Introduced OptionsWithDictionaryWithNullableEnumValue and MyValue enum in the test classes
- Modified CoreBindingHelpers.cs to unwrap NullableSpec for dictionary element types
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs | Added test for dictionary binding with nullable enum values |
src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs | Added supporting test classes and enum for nullable enum dictionary values |
src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs | Updated to unwrap nullable types for proper binding |
src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs
Outdated
Show resolved
Hide resolved
Tagging subscribers to this area: @dotnet/area-extensions-configuration |
…itter/CoreBindingHelpers.cs Co-authored-by: Copilot <[email protected]>
src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for considering my feedback
Fixes #115343