ssannandeji / Zenject-2019

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

Regression: ByNewContextPrefab<TInstaller> fails to check installer base class injectables #565

Open sbergen opened 5 years ago

sbergen commented 5 years ago

We are upgrading from 8c63509b8fdff97338d5f8aafb6a6bbe18a12e01 (7.1.0'ish IIRC) to v7.3.1, and when doing something like

Container.BindFactory<TParam, T, T.Factory>()
  .FromSubContainerResolve()
  .ByNewContextPrefab<TInstaller>(somePrefab);

where TInstaller derives from TBaseInstaller, which derives from MonoInstaller, and TBaseInstaller gets TParam injected, an error like ZenjectException: Assert hit! Could not find match for argument type 'TParam' when injecting into sub container installer 'TInstaller' will be hit both during validation and runtime.

Adding .Concat(installerInjectables.BaseTypeInfo.AllInjectables) after https://github.com/svermeulen/Zenject/blob/1dc88aa/UnityProject/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs#L44 solves the issue, but I'm not sure if that's the correct place to do it.

If this information isn't enough, I can try and make a minimal repro on request.