Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Hybrid or Http scoped service in IOC container might fail to instantiate

Found in

EPiServer.CMS.Core 9.5.0

Fixed in

EPiServer.CMS.Core 9.11.0

(Or a related package)

Created

Jun 14, 2016

Updated

Jul 06, 2016

Area

CMS Core

State

Closed, Fixed and tested


Description

If an IOC registered service has a constructor with an argument that is an array or an IEnumerable, instantiation of the service might fail. The cause of the failure is that the constructor argument is retrieved as IServiceLocator.GetInstance(argumentType), instead of IServiceLocator.GetAllInstance(arrayElementType).

Workaround: Register the array or IEnumerable in an IOC container with an implementation that calls IServiceLocator.GetAllInstances.