ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D
MIT License
2.53k stars 363 forks source link

[7.2 BUG] [CompilerError] The type `Zenject.SubContainerCreatorByInstaller' does not contain a constructor that takes `2' arguments #538

Closed FullStackForger closed 5 years ago

FullStackForger commented 6 years ago
[CompilerError] The type `Zenject.SubContainerCreatorByInstaller' does not contain a constructor that takes `2' arguments
Compiler Error at Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerInstallerBindingFinalizer.cs:38 column 17

I am using unity 2018.2.3f1

It seems that, there are some missing arguments, for example in: Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerInstallerBindingFinalizer.cs:

        ISubContainerCreator CreateContainerCreator(DiContainer container)
        {
            return new SubContainerCreatorCached(
                new SubContainerCreatorByInstaller(container, _installerType));
        }

I took a look at SubContainerCreatorByInstaller and indeed there is only single override there with minimum 3 required arguments.

How did that possibly pass the test? What am I missing there?

FullStackForger commented 6 years ago

To make unity compile ok locally I added

        public SubContainerCreatorByMethod(
            DiContainer container,
            Action<DiContainer> installMethod)
            : base(container,  new SubContainerCreatorBindInfo())
        {
            _installMethod = installMethod;
        }

and

        public SubContainerCreatorByInstaller(
            DiContainer container,
            Type installerType)
            : this(container, new SubContainerCreatorBindInfo(), installerType, new List<TypeValuePair>())
        {
        }
svermeulen commented 6 years ago

Can you try a clean install? SubContainerInstallerBindingFinalizer.cs shouldn't exist anymore in version 7.2.0

jianmingyong commented 6 years ago

I have tested it. Unity updater do not remove files. You have to remove the files manually for any thing that is removed in each update. (Kinda sux that unity doesn't know which files were removed in each update)

svermeulen commented 5 years ago

Yeah I guess when updating from unity package you have to delete everything to avoid this issue