// before fixer
public readonly ref struct Example(ref int value)
{
private readonly ref int _value = ref value;
// Use auto-implemented property (RCS1085)
public int Value
{
get => _value;
set => _value = value;
}
}
// after fixer
public readonly ref struct Example(ref int value)
{
// Cannot initialize a by-value variable with a reference (CS8171) and a few other errors
public int Value { get; set; } = ref value;
}
A regular constructor fails in slightly different ways, but at the end of the day, ref backed properties can't be automatic.
Suggestion: exclude ref field backed properties from this analyzer.
A regular constructor fails in slightly different ways, but at the end of the day, ref backed properties can't be automatic.
Suggestion: exclude
reffield backed properties from this analyzer.