Trying to unbind an existing bound type, then bind it again with a new binding.
Reproduction Scenario
I have created a small reproduction, if you add this code to a default unity project with zenject and add the installer to your scene context:
public interface ISomething
{
void DoSomething();
}
public class Something : ISomething
{
public void DoSomething()
{
throw new System.NotImplementedException();
}
}
public class Installer : MonoInstaller
{
public override void InstallBindings()
{
Container.Bind<ISomething>().To<Something>().AsSingle();
Container.Unbind<ISomething>();
Container.Bind<ISomething>().To<Something>().AsSingle();
}
}
Expected Behaviour
There would be no errors and ISomething would be bound to Something as a singleton once.
Actual Behaviour
You will get a validation error that ISomething has been assigned AsSingle multiple times, but I was expecting that it would remove the bindings for ISomething then be replaced with the binding.
Scenario
Trying to unbind an existing bound type, then bind it again with a new binding.
Reproduction Scenario
I have created a small reproduction, if you add this code to a default unity project with zenject and add the installer to your scene context:
Expected Behaviour
There would be no errors and
ISomething
would be bound toSomething
as a singleton once.Actual Behaviour
You will get a validation error that
ISomething
has been assignedAsSingle
multiple times, but I was expecting that it would remove the bindings forISomething
then be replaced with the binding.