canton7 / canton7/Stylet

Func Factories cause a StackOverflow exception

Open
#24 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.1k
Forks
155
PR merge metrics
No merged PRs in 30d

Description

First 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 childViewModelFactory)
ChildViewModel(Func 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.