[release/9.0-rc1] Fallback to treating as object if not collection#106517
Merged
carlossanlop merged 4 commits intorelease/9.0-rc1from Aug 16, 2024
Merged
[release/9.0-rc1] Fallback to treating as object if not collection#106517carlossanlop merged 4 commits intorelease/9.0-rc1from
carlossanlop merged 4 commits intorelease/9.0-rc1from
Conversation
The reflection binder will fallback if a type does not meet collection heuristics, but the source generator did not.
This matches what the refelction binder does, and fixes the baseline diffs (and diagnostics changes) we were seeing for unsupported collection types.
Contributor
|
Tagging subscribers to this area: @dotnet/area-extensions-configuration |
tarekgh
approved these changes
Aug 16, 2024
Contributor
|
Has this been Tactics approved? @dotnet/area-extensions-configuration @tarekgh please review. |
Member
@carlossanlop review what? |
Contributor
|
I see your sign off. Sorry. |
Member
Not yet, I just filled in the template and sent the request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #106378 to release/9.0-rc1
/cc @ericstj
Customer Impact
Configuration Binder source generator cannot bind objects that implement
IEnumerablebut notICollection<>orIDictionary<,>. IOW an enumerable type that's not treated as a collection.Apache Kafka has a package with configuration objects like this that expose their strongly named properties as an
IEnumerable<KeyValuePair<string,string>>: https://github.com/confluentinc/confluent-kafka-dotnet/blob/49f8188eeff4e6a77f9c1bcef68c504e773359f6/src/Confluent.Kafka/Config.cs#L28This type binds fine with the reflection binder, but fails when using the source generator.
Regression
Not a regression, but a blocker for folks wanting to enable the source generator / aot.
Testing
Unit tests added, baseline tests evaluated. No regressions, no changes to existing emitted code. New scenarios added to cover these types. Customer type validated fixed with the change.
Risk
Medium - it's enabling binding of types that were previously considered "not supported". This shouldn't break existing successful usage, but it could cause problems when we start to see types we didn't see before. For this reason we'd like to get this out in RC1 and give a chance for customer feedback.
Risk to release is low. This shouldn't risk the RC1 build / stabilization.