Skip to content

[release/9.0] Fix HashSet copy constructor handling of instances that have fallen back to the randomized hashcode generator. (#107613)#107685

Merged
carlossanlop merged 1 commit intodotnet:release/9.0from
eiriktsarpalis:fix-hashset-comparison-net90
Sep 16, 2024
Merged

[release/9.0] Fix HashSet copy constructor handling of instances that have fallen back to the randomized hashcode generator. (#107613)#107685
carlossanlop merged 1 commit intodotnet:release/9.0from
eiriktsarpalis:fix-hashset-comparison-net90

Conversation

@eiriktsarpalis
Copy link
Member

Backport of #107613 to release/9.0

/cc @eiriktsarpalis

Customer Impact

  • Customer reported
  • Found internally

Fixes a customer reported issue where passing a HashSet<string> that has fallen back to randomized string comparison will result in a corrupted set being created.

Regression

  • Yes
  • No

Likely introduced in .NET 5 via #37180 which brought in non-randomized string comparison.

Testing

Added unit testing validating that the copy constructor works as expected.

Risk

Moderate. While this is a targeted fix, HashSet<T> is a very common core type so any change carries an elevated degree of risk.

@eiriktsarpalis eiriktsarpalis added this to the 9.0.0 milestone Sep 11, 2024
@eiriktsarpalis eiriktsarpalis added the Servicing-consider Issue for next servicing release review label Sep 11, 2024
@dotnet-policy-service
Copy link
Contributor

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

@eiriktsarpalis eiriktsarpalis changed the title Fix HashSet copy constructor handling of instances that have fallen back to the randomized hashcode generator. (#107613) [release/9.0] Fix HashSet copy constructor handling of instances that have fallen back to the randomized hashcode generator. (#107613) Sep 11, 2024
@carlossanlop
Copy link
Contributor

@artl93 did you get a chance to look at this one? It's ask-mode so needs M2 approval.

@artl93 artl93 added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 16, 2024
@carlossanlop carlossanlop merged commit 6932f10 into dotnet:release/9.0 Sep 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2024
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.

4 participants