You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The result of the ReferenceEquals call will always be false: the type of the x and y variables is ImmutableRule (readonly struct, value type). So, values will be boxed and references to newly created objects will differ.
In the x.Id.IsEqualTo(x.Id) invocation the x.Id expression is compared with itself. It looks like the correct invocation is x.Id.Equals(y.Id).
What is Expected?
No described flaws in the method implementations.
How Did You Get This To Happen?
I've checked the latest sources via the PVS-Studio analyzer.
System Details
Installed Packages
-
Output Log
-
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Thank you for reporting this issue. This is indeed an oversight that we need to fix.
It is a minor issue at this moment as the only place that makes use of this Equals call is not meant to be used yet, but rather is a placeholder for future development that is intended.
When finding the distinct rules that are available in Chocolatey CLI
and its extensions, the equals and GetHashCode was incorrectly
implemented which in some cases causes the incorrect rules to be
returned, or not returned.
This commit updates these two methods to handle the check for
getting the hash code, and comparing immutable rules in the way
that we expect them to behave.
Checklist
What You Are Seeing?
It looks like there are 2 errors in the
RuleIdEqualityComparer.Equals
method implementation.Link to the sources.
Code fragment:
Issues
The result of the
ReferenceEquals
call will always befalse
: the type of thex
andy
variables isImmutableRule
(readonly struct, value type). So, values will be boxed and references to newly created objects will differ.In the
x.Id.IsEqualTo(x.Id)
invocation thex.Id
expression is compared with itself. It looks like the correct invocation isx.Id.Equals(y.Id)
.What is Expected?
No described flaws in the method implementations.
How Did You Get This To Happen?
I've checked the latest sources via the PVS-Studio analyzer.
System Details
Installed Packages
Output Log
Additional Context
No response
The text was updated successfully, but these errors were encountered: