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
{{ message }}
This repository was archived by the owner on Oct 20, 2023. It is now read-only.
Resolving IReadOnlyCollection<ICommon> (or other collection types) with the configuration shown below results in a silent failure to construct Dependency2 as the constructor parameter type ITransitiveDependency is not registered.
This behavior leads to hard to diagnose misconfigurations.
publicstaticclassProgram{publicstaticvoidMain(){varcontainer=newContainer(builder =>{builder.Register<ICommon,Dependency1>();builder.Register<ICommon,Dependency2>();});varinstances=container.GetInstance<IReadOnlyCollection<ICommon>>();// Contains only Dependency1// instances.Count == 1varinstance=container.GetInstance<Dependency2>();// Fails as expected:// Singularity.Exceptions.DependencyResolveException: Failed to resolve dependency SingularityEnumerable.Dependency2}}publicinterfaceICommon{}publicclassDependency1:ICommon{}publicclassDependency2:ICommon{publicDependency2(ITransitiveDependencyunregistered){}}publicinterfaceITransitiveDependency{}
Expected behavior
The call to container.GetInstance<IReadOnlyCollection<ICommon>>() should fail with the same exception as the call to container.GetInstance<Dependency2>().