[release/8.0-rc1] Fix ToFrozenDictionary(selectors) on empty sources (#90599)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Tue, 15 Aug 2023 18:16:33 +0000 (11:16 -0700)
committerGitHub <noreply@github.com>
Tue, 15 Aug 2023 18:16:33 +0000 (11:16 -0700)
commit9607d252b0f325340bb9e28355fa95c28c151d9f
treef4797c47740a0c01c9d1a83f732f61e2bdd23b8e
parentc5aba1b2c0ad7b70d299c3afc0689fcb7a439d43
[release/8.0-rc1] Fix ToFrozenDictionary(selectors) on empty sources (#90599)

* Fix ToFrozenDictionary(selectors) on empty sources

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.

* Address PR feedback

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/FrozenDictionary.cs
src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/FrozenSet.cs
src/libraries/System.Collections.Immutable/tests/Frozen/FrozenDictionaryTests.cs
src/libraries/System.Collections.Immutable/tests/Frozen/FrozenSetTests.cs