Zum Inhalt springen

Infinite recursion (CA2011)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key dotnet.codequality.infinite-recursion · Severity critical · Category codequality

Microsoft analyzer CA2011. Flags a property setter that assigns the property itself, which recurses until the process dies with a stack overflow. A getter that reads itself and a method that calls itself are reported by Unconditional recursion (ARCH717).

public string Name
{
get => _name;
set => Name = value; // assigns itself
}
private string _name = "";
public string Name
{
get => _name;
set => _name = value;
}