Func Factories cause a StackOverflow exception
See original GitHub issueFirst of all, awesome project, thumb up, hope you continue this project.
I’m in a unique situation that I need a child view model to create a new parent view model; the parent view model is just a kind of content container, so it can create child view model dynamically according to the input model info. Constructors look like this:
ParentViewModel(Func<ChildViewModel> childViewModelFactory)
ChildViewModel(Func<ParentViewModel> parentViewModelFactory)
When build it’ll cause a StackOverflow. I’ve read “Circular Dependencies” wiki, but i still do not know how to configure a Func Factory.
Then I try to use Abstract Factories, it can avoid the stackoverflow exception, but I still wonder why Func Factory fails in this scenario.
Thank you in advance
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Why am I getting stackoverflow exception when calling a ...
The problem I'm facing is that when the 'handlemobimodals()' function is called for a second time within the test, I get a Stack...
Read more >Professional AngularJS - Page 98 - Google Books Result
... will cause an error: m.factory('myService', function($scope) { // Error: $scope ... discussion topic on question and answer forums like Stack Overflow.
Read more >StackOverflowException Class (System)
The exception that is thrown when the execution stack exceeds the stack size. This class cannot be inherited.
Read more >InfoWorld - Dec 19, 1994 - Page 55 - Google Books Result
... the latter statement fails, generating a runtime error. ... property, function, method, and statement, is available from Microsoft Press at extra cost ......
Read more >stack overflow exception, have no idea what and where!!
this condition is likely never met, causing your code to run forever until the stack just cant store what is necesary for another...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it probably gets caught in this cycle:
I’ll investigate when I get some time (slightly snowed under at the moment, sorry), and see if there’s an easy fix.
OK