public class Foo
{
public Bar Bar { get; set; }
}
public class Bar
{
public Foo Foo { get; set; }
}
…
anon.Any<Foo>(PopulateOption.Deep); // Results in an OutOfMemoryException
AnonymousData should detect cycles and react to them. Possible options, that maybe should be configurable behavior by the caller.
- Throw an exception that provides information about the cycle.
- Simply don't populate the property that causes the cycle.
- Populate the property with the "parent" value.