Skip to content

Need to detect cycles when creating complex anonymous types. #4

Description

@wekempf
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.

  1. Throw an exception that provides information about the cycle.
  2. Simply don't populate the property that causes the cycle.
  3. Populate the property with the "parent" value.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions