0

On clicking Create new in Sitecore Form getting the below error:

Message: /formbuilder/load?id=&sc_formmode=new&sc_formlang=en&sc_site=shell&_=1597294914778StackTrace:    at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(Type serviceType)
   at application1.website.Framework.DependencyInjection.Autofac.Factory.AutofacControllerFactory.GetControllerInstance(RequestContext context, Type controllerType) in C:\application\application1\website\App_Start\Autofac\AutofacControllerFactory.cs:line 25
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Exception: Autofac.Core.DependencyResolutionException
Message: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Sitecore.ExperienceForms.Mvc.Controllers.FormBuilderController' can be invoked with the available services and parameters:
Cannot resolve parameter 'Sitecore.ExperienceForms.Mvc.IFormRenderingContext formRenderingContext' of constructor 'Void .ctor(Sitecore.ExperienceForms.Mvc.IFormRenderingContext, Sitecore.ExperienceForms.Processing.IFormSubmitHandler)'.
Source: Autofac
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(Type serviceType)
   at application1.website.Framework.DependencyInjection.Autofac.Factory.AutofacControllerFactory.GetControllerInstance(RequestContext context, Type controllerType) in C:\application\application1\website\App_Start\Autofac\AutofacControllerFactory.cs:line 25
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Any solution to resolve this? Some binding registry might be missing but could not pin point the same.

Updated 26/08/2020:

If am trying to replace the default dependency injection config as mentioned below: https://doc.sitecore.com/developers/90/sitecore-experience-manager/en/dependency-injection.html#UUID-56e8fc3c-794f-c66d-6db1-86acadcf2e5c_id_replace-service-provider

How should i Replace the: return MyFavouriteServiceProvider.Build(serviceCollection);

If i try using below:

protected override IServiceProvider BuildServiceProvider(IServiceCollection serviceCollection) { var builder = new ContainerBuilder(); // Register Sitecore services in Autofac. builder.Populate(serviceCollection); // Register our custom services via a module. builder.RegisterModule(); // Register all MVC controllers in the current assembly. builder.RegisterControllers(Assembly.GetExecutingAssembly()); IContainer container = builder.Build(); // Return Autofac's service provider adaptor. return container.Resolve(); }

What will be the ServicesModule? I am facing issue with the sitecore Forms module how should I implement the override BuildServiceProvider method.

Using: Sitecore 9.1 Autofac and dependent dll version 5.0.0

4
  • 1
    I would remove Autofac and just use the DI pattern established by Sitecore.
    – Richard Seal
    Commented Aug 13, 2020 at 12:43
  • Is there a way to initialize Sitecore.ExperienceForms.Mvc.Controllers.FormBuilder Controller using autofac.
    – Debaparna
    Commented Aug 14, 2020 at 3:45
  • You would need to replace the service provider: doc.sitecore.com/developers/90/sitecore-experience-manager/en/…
    – Richard Seal
    Commented Aug 14, 2020 at 13:03
  • is there any further update on this topic ?
    – Ravi Nigam
    Commented Apr 27, 2023 at 11:53

0

Your Answer

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