This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
[release/3.1] Port polymorphic perf and better dictionary support #42008
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.
Update: the fixes for these two issues now exist in PRs #42057 and #42050 since these do not take the dependency on #42009 which may not be accepted.
note: the branch here is based on @layomia current branch for another issue which is not yet in 3.1 so you can ignore the first commit here. The next two commits handle two separate issues but since they conflict, just one PR:
Ports the following to release/3.1
#41753
#41903
Issues:
IDictionary<TKey, TValue>
but do not implement the non-genericIDictionary
Description
GetEnumerator()
(either through theIEnumerable
orIDictionary
interfaces) returns anIDictionaryEnumerable
as required for types that implementIDictionary
. However, there are certain "newer" generic collection types outside of the BCL that don't implementIDictionary
or returnIDictionaryEnumerable
from theirIEnumerable.GetEnumerator()
method (note thatIDictionary<TKey, TValue>
does not implementIDictionary
). This caused aInvalidCastException
at runtime. The fix is to assumeIEnumerable<KeyValuePair<TKey, TValue>>
instead ofIDictionaryEnumerable
for generic dictionaries.Customer Impact
IDictionary
.Regression?
No. For the dictionary issue, the
InvalidCastException
is no longer encountered.Risk
Low.
The performance issue is very specific to polymorphic serialization and was already tested. An additional test was added to verify the cache is properly keying.
For the dictionary issue, existing tests were not modified and new tests added that only implement the generic
IDictionary<TKey, TValue>
.