Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0-rc1] Fix ToFrozenDictionary(selectors) on empty sources #90599

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 15, 2023

Backport of #90595 to release/8.0-rc1

/cc @stephentoub

Customer Impact

The new ToFrozenDictionary extension method erroneously throws an exception when used with an empty source and a key value selector, e.g.

IEnumerable<T> source = ...;
... = source.ToFrozenDictionary(t => CreateKey(t));

will throw if source has no elements.

Testing

Added new tests to cover these overloads with an empty source.

Risk

Minimal. The fix just routes these overloads through an existing one.

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

As part of optimizing construction, the empty check when using ToFrozenDictionary taking selector delegates was skipped, leading to later failures when an empty source is used.
@ghost
Copy link

ghost commented Aug 15, 2023

Tagging subscribers to this area: @dotnet/area-system-collections
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #90595 to release/8.0-rc1

/cc @stephentoub

Customer Impact

Testing

Risk

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-System.Collections

Milestone: -

@stephentoub stephentoub added Servicing-consider Issue for next servicing release review and removed Servicing-consider Issue for next servicing release review labels Aug 15, 2023
@stephentoub stephentoub force-pushed the backport/pr-90595-to-release/8.0-rc1 branch from 60d7f12 to 70c9f16 Compare August 15, 2023 14:36
@stephentoub stephentoub added the Servicing-approved Approved for servicing release label Aug 15, 2023
@stephentoub
Copy link
Member

Failure is #90309

@carlossanlop, can you help merge?

@ericstj ericstj merged commit 9607d25 into release/8.0-rc1 Aug 15, 2023
103 of 107 checks passed
@jkotas jkotas deleted the backport/pr-90595-to-release/8.0-rc1 branch August 27, 2023 16:55
@radical radical mentioned this pull request Sep 26, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Collections Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants