2

I am working on a Sitecore upgrade project and we are encountering an issue after our solution upgrade.

Below is the attached screenshot.

enter image description here


        Server Error in '/' Application.
    ________________________________________
    Implementation type 'Sitecore.XA.Foundation.Variants.Abstractions.Services.PassthroughService' can't be converted to service type 'Sitecore.XA.Foundation.Variants.Abstractions.Services.IPassthroughService'
    Description: An unhandled exception occurred.
    
    Exception Details: System.ArgumentException: Implementation type 'Sitecore.XA.Foundation.Variants.Abstractions.Services.PassthroughService' can't be converted to service type 'Sitecore.XA.Foundation.Variants.Abstractions.Services.IPassthroughService'
    
    Source Error:
    
    Line 13:             foreach (BaseVariantField variantField in Model.VariantFields)
    Line 14:             {
    Line 15:                 @Html.RenderingVariants().RenderVariant(variantField, Model.Item, Model.RenderingWebEditingParams, Model)
    Line 16:             }
    Line 17:         }
    
    Source File: c:\inetpub\wwwroot\sc102sc.dev.local\Views\Variants\Page Content.cshtml    Line: 15
    
    Stack Trace:
    
    [ArgumentException: Implementation type 'Sitecore.XA.Foundation.Variants.Abstractions.Services.PassthroughService' can't be converted to service type 'Sitecore.XA.Foundation.Variants.Abstractions.Services.IPassthroughService']
       Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite..ctor(ResultCache cache, Type serviceType, ConstructorInfo constructorInfo, ServiceCallSite[] parameterCallSites) +246
       Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain) +455
       Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot) +377
       Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain) +84
       Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain) +152
       System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +75
       Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor(Type serviceType) +97
       System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +75
       Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) +46
       Microsoft.Extensions.DependencyInjection.ConstructorMatcher.CreateInstance(IServiceProvider provider) +132
       Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters) +485
       Sitecore.Configuration.DefaultFactory.CreateFromServiceProvider(XmlNode configNode, Boolean assert) +481
    
    [ConfigurationException: Could not create object from service provider . Config XML: <processor type="VGWMP.Foundation.HCPSiteExtensions.Pipelines.RenderVariantField.RenderSortedReference, VGWMP.Foundation.HCPSiteExtensions" resolve="true" patch:source="VGWMP.Foundation.HCPSiteExtensions.VariantField.config" xmlns:patch="http://www.sitecore.net/xmlconfig/" />]
       Sitecore.Configuration.DefaultFactory.CreateFromServiceProvider(XmlNode configNode, Boolean assert) +641
       Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +138
       Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert) +68
       Sitecore.Pipelines.CorePipelineFactory.GetObjectFromType(XmlNode processorNode) +91
       Sitecore.Pipelines.CorePipelineFactory.GetProcessorObject(XmlNode processorNode) +138
       Sitecore.Pipelines.CoreProcessor.GetMethod(Object[] parameters) +136
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1255
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +114
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +114
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderReference.RenderField(RenderVariantFieldArgs args) +631
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +132
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +132
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +132
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +132
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +132
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +132
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +132
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection.RenderField(RenderVariantFieldArgs args) +420
       Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.RenderVariantField.RenderVariantFieldProcessor.Process(RenderVariantFieldArgs args) +114
       (Object , Object ) +9
       Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +1268
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
       Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
       Sitecore.XA.Foundation.Variants.Abstractions.Renderers.VariantRenderer.RenderVariantField(BaseVariantField variant, Item item, Dictionary`2 parameters) +240
       Sitecore.XA.Foundation.RenderingVariants.Extensions.RenderingVariantsExtensions.RenderVariant(BaseVariantField variantField, Item item, RenderingWebEditingParams parameters, Object model, Func`3 hrefOverrideFunc) +207
       ASP._Page_Views_Variants_Page_Content_cshtml.Execute() in c:\inetpub\wwwroot\sc102sc.dev.local\Views\Variants\Page Content.cshtml:15
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
       System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
       System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +91
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
       System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +698

New contributor
Neha Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

3 Answers 3

1

The interface Sitecore.XA.Foundation.Variants.Abstractions.Services.IPassthroughService interface has been marked as obsolete in Sitecore 10.2.

Alternative: Use the Sitecore.XA.Foundation.SitecoreExtensions.Services.IPassthroughService interface instead.

Please try this alternative and let me know if you encounter any further issues.

1

The interface Sitecore.XA.Foundation.Variants.Abstractions.Services.IPassthroughService has become obsolete in Sitecore 10.2.

enter image description here

You will need to resolve the dependency for IPassthroughService inside the render variant field extension VGWMP.Foundation.HCPSiteExtensions.Pipelines.RenderVariantField.RenderSortedReference, VGWMP.Foundation.HCPSiteExtensions with the following interface in order to resolve this issue.

Sitecore.XA.Foundation.SitecoreExtensions.Services.IPassthroughService

The reason you are getting this issue is because Sitecore.XA.Foundation.Variants.Abstractions.Services.IPassthroughService is no longer resolved through dependency injection in Sitecore 10.2.

As an additional note you can check the dependency injection resolution for an interface on the following url /sitecore/admin/ShowServicesConfig.aspx, to know the interface and class that is being resolved through dependency injection.

enter image description here

Hope this helps!!! Let me know in case you face any issues.

1

The error you are getting in the Sitecore.XA.Foundation.Variants.Abstractions.Services.PassthroughService. If you try to extract the Sitecore.XA.Foundation.Variants.Abstractions DLL you will get the information about it.

using System;

#nullable disable
namespace Sitecore.XA.Foundation.Variants.Abstractions.Services
{
  [Obsolete("This interface is obsolete since SXA 10.2. It will be removed after two consecutive releases. Use Sitecore.XA.Foundation.SitecoreExtensions.Services.IPassthroughService instead")]
  public interface IPassthroughService : Sitecore.XA.Foundation.SitecoreExtensions.Services.IPassthroughService
  {
  }
}

To resolve this you need to use the Sitecore.XA.Foundation.SitecoreExtensions.Services.IPassthroughService

Here is the reference screenshot.

enter image description here

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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