[release/7.0] Fix Binding with IList<>, ICollection and IDictionary<,> implementer types #78118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #77857 and #77582 to release/7.0
/cc @tarekgh
Customer Impact
Customers using configurations which bind to the types
IList<T>
andICollection<T>
and try to add items to the produced collection objects will get exception tellingUnhandled exception. System.NotSupportedException: Collection was of a fixed size.
. Also, binding using types implementIDictionary<,>
interface (but not aDictionary<,>
) will not work as expected. It will end up not adding the configuration data to that object. These issues are reported by R9 in the issue #77725 and IDictionary issue reported by other user in the issue #77246Testing
I spent enough time testing these cases manually and ensuring we are not missing any related cases. Also, I have added more tests to validate such fix and to ensure will not run into similar regressions in the future.
Risk
Medium, although there is some risk when touching the configuration code, but I spent enough time testing the change to mitigate the risk. The change is good enough to proceed with.