You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Options binding fails on get-only IDictionary<,> properties #75626
When binding an options type that contains a public get-only property of type IDictionary<,>, the binding is skipped and the dictionary is not populated.
The dictionary property on the options instance should have one key-value pair. Console will write out "Count = 1".
Actual behavior
The dictionary property on the options instance has not key-value pairs. Console will write out "Count = 0".
Regression?
Yes, this worked in .NET 7 Preview 7, all prior previews, and all prior .NET (Core) versions.
Known Workarounds
Changing the property type to Dictionary<,> seems to work around this issue.
Configuration
Windows 11 x64 .NET SDK 7.0.100-rc.1.22431.12
Not specific to this configuration, it is failing on all OSes and all architectures in the dotnet-monitor PR builds when attempting to update to .NET 7 RC 1.
Activity
Fix Configuration.Binder for collection properties with no setters
eerhardt commentedon Sep 15, 2022
Thanks for the bug report, @jander-msft. I have a fix prepared and my plan is to ensure the fix gets in for 7.0-rc2.
FYI - @ericstj
Fix Configuration.Binder for collection properties with no setters (#…
Fix Configuration.Binder for collection properties with no setters
Fix Configuration.Binder for collection properties with no setters (#…