Version Used: 16.4.0 Preview 6.0
Steps to Reproduce:
- Paste following code:
#nullable enable
using System;
namespace N {
public class C {
public int X;
}
}
- Run
Generate Equals and GetHashCode... on C, leave Generate operators checked.
Expected Behavior:
Generated operators:
public static bool operator ==(C? left, C? right) => EqualityComparer<C?>.Default.Equals(left, right);
public static bool operator !=(C? left, C? right) => !(left == right);
Actual Behavior:
Generated operators:
public static bool operator ==(C left, C right) => global::System.Collections.Generic.EqualityComparer<global::N.C>.Default.Equals(left, right);
public static bool operator !=(C left, C right) => !(left == right);
Which then cause this code to produce warning:
C? c = null;
if (c == null) { // Possible null reference argument for parameter 'left' in 'bool C.operator ==(C left, C right)'.
}
Version Used: 16.4.0 Preview 6.0
Steps to Reproduce:
Generate Equals and GetHashCode...onC, leaveGenerate operatorschecked.Expected Behavior:
Generated operators:
Actual Behavior:
Generated operators:
Which then cause this code to produce warning: