dotnet/roslyn
View on GitHubUnclear CS0252 (Possible unintended reference comparison)
Open
#58,996 opened on Jan 21, 2022
Area-CompilersBugConcept-Diagnostic Clarityhelp wanted
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (Avg merge 6d 17h) (256 merged PRs in 30d)
Description
Version Used:
17.1.0 P1.1
Steps to Reproduce:
using System;
public class C
{
public void M(Action x, Action y)
{
_ = (MulticastDelegate)x == y;
}
}
Expected Behavior:
Either no warning, or a more clear warning.
Actual Behavior:
warning CS0252: Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'MulticastDelegate'