5

I've defined a custom pipeline in my ConfigureSitecore, but when I run the engine I get the following error:

InvalidOperationException: Unable to resolve service for type 'Sitecore.Framework.Pipelines.IPipelineConfiguration' while attempting to activate 'CustomPipeline'.

IPipelineConfiguration is the first argument of the pipeline implementation, and is simply passed to the base constructor, so I'm not sure why it wouldn't be configured in the DI container.

5

The short answer is that the custom pipeline needs to accept the argument as IPipelineConfiguration<ICustomPipelineInterface>

When you configure a pipeline via pipelines.AddPipeline<T,K> or pipelines.ConfigurePipeline<T>, you're actually configuring a DI-injected service for IPipelineConfiguration<T>. When the pipeline is created at runtime, it needs the typed service in order to get access to the configured blocks.

As to why the base Pipeline class doesn't accept the generic form of IPipelineConfiguration: the pipeline interface is not one of the generic type parameters for Pipeline so it has no reference to it. It could have been added, but my only guess as to why it wasn't is that it would have made declarations of pipeline classes very "wordy".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.