Closed marsermd closed 6 years ago
Probably not related to Zenject Tests Integration Tests failing
In this case the minimal example turned out to be really tiny:)
public class BadInstaller : MonoInstaller
{
public class Foo
{
[Inject]
public void Init(Bar bar)
{
Debug.Log("init");
}
}
public class Bar
{
}
public override void InstallBindings()
{
Debug.Log("started!");
Container.Bind<Foo>().FromSubContainerResolve().ByMethod(InstallSubContainer).AsSingle().NonLazy();
Debug.Log("finished!");
}
private void InstallSubContainer(DiContainer sub)
{
sub.BindInterfacesAndSelfTo<Foo>().AsSingle();
//Note that here we are binding to the parent container
Container.Bind<Bar>().ToSelf().AsSingle();
}
}
Thanks for the small reproducible example, that always really helps
Binding to a parent container from within a subcontainer installer method is not something I expected anyone to be doing :) Not really sure why you would need/want to do that. But in any case it's fixed now on master branch with the above commit
After migrating from Zenject 5.4.0 to 5.5.1, I receive InvalidOperationException in
DIContainer.ResolveDependencyRoots()
in lineforeach (var bindinPair in _providers)
This happens when I try to add a binding to a parent container from it's sub-container (during InstallBindings stage of both of the containers).
Minimal example is in progress.
Unity version: 2017.3.1f1 with .NET 4.6