You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class Test1 {
[Inject] public Test2 Foo;
}
public class Test2 {
public string Bar = "Bar";
}
public class GameRoot : ContextRoot {
public override void SetupContainers() {
var container = this.AddContainer<InjectionContainer>();
container.resolutionMode = ResolutionMode.RETURN_NULL;
container.Bind<Test2>().ToSingleton();
container.Bind<Test1>().ToSingleton();
}
}
throws the following exception on the container.Bind<Test1>().ToSingleton() line:
NullReferenceException: Object reference not set to an instance of an object
Adic.Injection.Injector.OnBeforeAddBinding (IBinder source, Adic.Binding.BindingInfo& binding) (at Assets/Adic/Scripts/Framework/Injection/Injector.cs:517)
Adic.Binding.Binder.AddBindingToDictionary (Adic.Binding.BindingInfo binding) (at Assets/Adic/Scripts/Framework/Binding/Binder.cs:71)
Adic.Binding.Binder.AddBinding (Adic.Binding.BindingInfo binding) (at Assets/Adic/Scripts/Framework/Binding/Binder.cs:62)
Adic.Binding.BindingFactory.AddBinding (System.Object value, BindingInstance instanceType) (at Assets/Adic/Scripts/Framework/Binding/BindingFactory.cs:178)
Adic.Binding.BindingFactory.ToSingleton () (at Assets/Adic/Scripts/Framework/Binding/BindingFactory.cs:38)
GameRoot.SetupContainers () (at Assets/_/Scripts/GameRoot.cs:36)
Adic.ContextRoot.Awake () (at Assets/Adic/Scripts/Extensions/ContextRoot/ContextRoot.cs:69)
If I change the ToSingleton() methods to ToSelf() OR if I change the resolution mode to ALWAYS_RESOLVE then the bindings work correctly.
The text was updated successfully, but these errors were encountered:
Using Adic 2.20.1 the following code:
throws the following exception on the
container.Bind<Test1>().ToSingleton()
line:If I change the
ToSingleton()
methods toToSelf()
OR if I change the resolution mode toALWAYS_RESOLVE
then the bindings work correctly.The text was updated successfully, but these errors were encountered: