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
After creating a binding as a singleton, that value cannot then be unbound/rebound via Container.Unbind() or Container.Rebind().
The following two code snippets throw the error: ZenjectException: Assert hit! Attempted to use AsSingle multiple times for type 'string'. As of Zenject 6+, AsSingle as can no longer be used for the same type across different bindings. See the upgrade guide for details.
My use case is that I'd like to have a separate singleton instance of a class for each container. I was hoping to run the following installer in each container, so that each container has some contextual information I can use to improve logging:
IContainerInfo containerInfo = new ContainerInfo(m_Settings.ContainerName);
Container.Rebind<IContainerInfo>().To<IContainerInfo>().FromInstance(containerInfo).AsSingle();
The text was updated successfully, but these errors were encountered:
I am hitting this too but when using the non generic version where you pass in the type as an arg. I remember a while ago that there was some discussion around unbind and there may have been another method which ACTUALLY unbound something but for the life of me cannot remember what it was (or I am completely wrong).
Either way I am having things not being unbound when calling Unbind(type) on them.
After creating a binding as a singleton, that value cannot then be unbound/rebound via Container.Unbind() or Container.Rebind().
The following two code snippets throw the error:
ZenjectException: Assert hit! Attempted to use AsSingle multiple times for type 'string'. As of Zenject 6+, AsSingle as can no longer be used for the same type across different bindings. See the upgrade guide for details.
Example 1:
Example 2:
My use case is that I'd like to have a separate singleton instance of a class for each container. I was hoping to run the following installer in each container, so that each container has some contextual information I can use to improve logging:
The text was updated successfully, but these errors were encountered: