Aller au contenu

Infinite recursion (CA2011)

Ce contenu n’est pas encore disponible dans votre langue.

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;
}