AutoBogus
AutoBogus copied to clipboard
Recursive depth limit not implemented when generating constructor parameters
No checks are in place for skipping the generation of reference types for a constructor. This will lead to a StackOverflowException if a reference type's constructor has itself as one of the parameters, even if that parameter is optional:
public class Node
{
public string Data { get; set; }
public Node Parent { get; set; }
public Node(string data, Node parent = null)
{
Data = data;
Parent = parent;
}
public static void Test()
{
var foo = AutoFaker.Generate<Node>(); // This will result in a StackOverflowException
}
}
@SpaceMonkeyy86 Recursive constructors are working and follow depth limits in soenneker.utils.autobogus