Skip to content

[release/v7.4] Fix PSMethodInvocationConstraints.GetHashCode method (#24965)#26953

Merged
jshigetomi merged 1 commit intoPowerShell:release/v7.4from
jshigetomi:backport24965
Mar 9, 2026
Merged

[release/v7.4] Fix PSMethodInvocationConstraints.GetHashCode method (#24965)#26953
jshigetomi merged 1 commit intoPowerShell:release/v7.4from
jshigetomi:backport24965

Conversation

@jshigetomi
Copy link
Collaborator

@jshigetomi jshigetomi commented Mar 9, 2026

Backport of #24965 to release/v7.4

Triggered by @jshigetomi

Original CL Label: CL-General

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

There is a difference between GetHashCode for array object itself and cumulative GetHashCode based on hashes of the array members.
@jshigetomi jshigetomi added CL-Engine Indicates that a PR should be marked as an engine change in the Change Log CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log and removed CL-Engine Indicates that a PR should be marked as an engine change in the Change Log labels Mar 9, 2026
@jshigetomi jshigetomi marked this pull request as ready for review March 9, 2026 18:31
Copilot AI review requested due to automatic review settings March 9, 2026 18:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backport to release/v7.4 of the fix for PSMethodInvocationConstraints.GetHashCode() so that hash codes are computed from the contents of the parameter/generic-argument arrays rather than the array object identities, aligning with the existing SequenceEqual-based Equals implementation.

Changes:

  • Update PSMethodInvocationConstraints.GetHashCode() to use SequenceGetHashCode() for ParameterTypes and GenericTypeParameters.

@jshigetomi jshigetomi merged commit cf4a2ee into PowerShell:release/v7.4 Mar 9, 2026
39 of 46 checks passed
jshigetomi added a commit to jshigetomi/PowerShell that referenced this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants