A property's accessor reads or assigns the property itself, which recurses until the stack overflows

tx0/csharp:recursive-propertydefaulterrorreliability/object-contractsdepth fastbug

What it finds

public int Count { get { return Count; } } calls its own getter, which calls it again, until the stack overflows. Usually a backing field such as count was meant. Accessors that read the property of another object, as other.Count, are left alone.

From the rule's source, recursive_property.rs.

Example from the rule's tests
class Order{    private int total;     public int Total    {        get { return Total; }tx0 reports: the accessor of Total reads Total itself, which recurses forever        set { Total = value; }tx0 reports: the accessor of Total assigns Total itself, which recurses forever    }     public int Count => Count;tx0 reports: the accessor of Count reads Count itself, which recurses forever     public int Fine    {        get { return total; }        set { total = value; }    }     public Order Next => this;    public int Same(Order other) => other.Total;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:recursive-property" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:recursive-property] reason="..."

tx0 explain tx0/csharp:recursive-property shows the same in the terminal. Found a false positive? Report it.