-
Notifications
You must be signed in to change notification settings - Fork 1
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
InfiniteLoopException - Limit Depth? #65
Comments
Hi, sorry you're facing issues. It seems silly to ask since I haven't updated the library in awhile, but are you on the latest version 1.8.2? I ask because I added recursion loops in my last commit. To try and reproduce the issue, I created a sample object via properties A.B.C.A and could randomize it without issue. The mechanism for this is on the RandomizerChainer, which will add a recursive reference if the previous type has already been created. Theoretically you shouldn't ever see the InfiniteLoopException, it means I missed a link in the creation chain and didn't set the parent correctly. I've located all the spots where that is seemingly possible, and have attempted a fix. Nuget should have version 1.8.3 here soon, I'm hoping it fixes your issue. If not, I'll need more details over how your type chain that's triggering the exception appears. Like are collections involved, generics, abstract classes, delegates... ect. As long as I can reproduce the issue with a test model, I'll be able to get it fixed here for you. |
Hey, thanks for getting back to me. . To answer your questions: Yes, I'm using version 1.8.2 and, while a rich object model, it is fairly simple so it does not use any (custom) generics, inheritance or delegates. It uses collections extensively and the issue I'm seeing involves a collection like so: Hope that will provide some clues as to the nature of the issue. If not, let me know and I'll endeavour to reproduce the issue in a repository I can share. Thanks again, |
Did you see if version 1.8.3 worked for you? I made another branch here to attempt to replicate and solve the issue, you can view the test here: I did encounter an issue with cloning objects, but not in creating them. So if you don't mind checking the model and comparing with yours I would be grateful. |
Hey, just updated to 1.8.3 and the InfiniteLoopException issue is gone. Great work, thanks! I'll close this issue now but any interest in a PR to support Uri and DateTimeOffset creation / duplication? I'm using these types extensively and currently need to add custom Create/CopyHints to support them. |
I have added Uri and DateTimeOffset support in the default hints released on version 1.8.4. |
Hi,
I have a very rich (broad and deep) object model for which I'm trying to generate test data. CreateAndFake is currently showing the best results with the least effort of any comparable library, but I'm running into an "InfiniteLoopException".
Now the error message provides a good explanation as to why I'm encountering the issue and my object model does have recursive types (a->b->c->a). However, as I don't really care about generating objects after the second generation (a->b) I was wondering whether it is possible to limit the depth of generator or simply ignore the "InfiniteLoopException" such that the generator continues to the next property (of whatever object it's generating) as if generation had completed successfully.
Hope thats clear??
I've tried looking into the Limiter implementation but it doesn't seem to be designed to handle this use case.
Anyway, thanks for the library. Really hope this issue can be resolved/worked around as the CreateAndFake looks very promising.
Cheers,
Ian
The text was updated successfully, but these errors were encountered: