Version Used: VS 15.7 Preview 2 (Roslyn 2.8.0.62716)
Steps to Reproduce:
- Copy the class below into a C# source file.
- Invoke the Quick Fix menu at the marked location and select either "Generate Equals" or "Generate Equals and GetHashCode".
- Make sure SetOnly is marked in the list and press "OK".
class Repro
{
int SetOnly { set { } }
$$
}
Expected Behavior: The property is not included in the list, and thus doesn't appear in the generated code.
Actual Behavior: The generated code looks something like this:
public override bool Equals(object obj)
{
var repro = obj as Repro;
return repro != null &&
this.SetOnly == repro.SetOnly; // Emits two CS0154 errors
}
public override int GetHashCode()
{
return 257811045 + this.SetOnly.GetHashCode(); // Emits one CS0154 error
}
Version Used: VS 15.7 Preview 2 (Roslyn 2.8.0.62716)
Steps to Reproduce:
Expected Behavior: The property is not included in the list, and thus doesn't appear in the generated code.
Actual Behavior: The generated code looks something like this: