Skip to content

Bad hash code calculation in PSMethodInvocationConstraints results in explosion of static cache #24964

@crazyjncsu

Description

@crazyjncsu

The hash code calculation in PSMethodInvocationConstraints only counts in the array members but not their elements, so the returned hash code would be different for two PSMethodInvocationConstraints instances that hold exactly the same elements in their array members.

The hash code of PSMethodInvocationConstraints is used by the static cache PSInvokeMemberBinder.s_binderCache because PSMethodInvocationConstraints is a member of the key for that cache, so you end up with every request being a cache miss in PSInvokeMemberBinder.s_binderCache.

=> HashCode.Combine(MethodTargetType, ParameterTypes, GenericTypeParameters);

Metadata

Metadata

Assignees

No one assigned

    Labels

    7.5-regressionThe issue is a regressionIssue-BugIssue has been identified as a bug in the product

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions