Skip to content

3.13.3 Regression - CollectionTally correctly handles ImmutableDictionary again#4097

Merged
mikkelbu merged 2 commits into
nunit:v3.13-devfrom
stevenaw:4095-fix-immutable-dictionary
Apr 19, 2022
Merged

3.13.3 Regression - CollectionTally correctly handles ImmutableDictionary again#4097
mikkelbu merged 2 commits into
nunit:v3.13-devfrom
stevenaw:4095-fix-immutable-dictionary

Conversation

@stevenaw

Copy link
Copy Markdown
Member

Fixes #4095

Allows CollectionTally to work with ImmutableDictionary properly again by avoiding a bulk-add for the ICollection case

{
if (items is ICollection ic)
return new ArrayList(ic);
var list = items is ICollection ic ? new ArrayList(ic.Count) : new ArrayList();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImmutableDictionary.CopyTo will convert the underlying type which is why the ctor which took in an ICollection was failing, but we can at least initialize the ArrayList to the proper size if it is known

@stevenaw stevenaw added this to the 3.13.4 milestone Apr 15, 2022

@manfred-brands manfred-brands left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mikkelbu mikkelbu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants