Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wekempf opened this issue Jul 27, 2018 · 0 comments
Open

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

wekempf opened this issue Jul 27, 2018 · 0 comments

Comments

@wekempf
Copy link
Owner

wekempf commented Jul 27, 2018

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant