None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type

4 years ago
I am developing a new plugin with Data access in Widget section.


I have registered my service using a dependencyregistrar file which is located on my own plugin project.



public virtual void Register(Autofac.ContainerBuilder builder, Core.Infrastructure.ITypeFinder typeFinder)
        {


            builder.RegisterType<DodSliderService>().As<IDodSliderService>().InstancePerLifetimeScope().PreserveExistingDefaults();

          
            //data context
            this.RegisterPluginDataContext<DodSliderObjectContext>(builder, "nop_object_context_dodslider");

            //override required repository with our custom context
            builder.RegisterType<EfRepository<DodSliderObject>>()
                .As<IRepository<DodSliderObject>>()
                .WithParameter(ResolvedParameter.ForNamed<IDbContext>("nop_object_context_dodslider"))
                .InstancePerLifetimeScope();
            
        }


Controller section
-------------------

public class WidgetDodSliderController : BasePluginController
    {
        private readonly IDodSliderService _dodSliderService;
        private readonly LocalizationService _localizationService;
        private readonly IPluginFinder _pluginFinder;


        public WidgetDodSliderController(
            IDodSliderService dodSliderService,
            LocalizationService localizationService,
            IPluginFinder pluginFinder)
        {
            this._dodSliderService = dodSliderService;
            this._localizationService = localizationService;
            this._pluginFinder = pluginFinder;
        }



I am able to install it successfully, but when trying to 'CONFIGURE' , it gives my below error: (This is driving my crazy from 2 days, really appreciable if anyone can help me)


None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Nop.Plugin.Widgets.DodSlider.Controllers.WidgetDodSliderController' can be invoked with the available services and parameters:
Cannot resolve parameter 'Nop.Services.Localization.LocalizationService localizationService' of constructor 'Void .ctor(Nop.Plugin.Widgets.DodSlider.Services.IDodSliderService, Nop.Services.Localization.LocalizationService, Nop.Core.Plugins.IPluginFinder)'.



Searched for almost all sites

p.s: followed the same things as in 'Nop.Plugin.Feed.Froogle'
4 years ago
It should be ILocalizationService instead of LocalizationService. You should use the interface instead of the actual class. ;)
4 years ago
Many many thanks wooncherk :)


You saved me.. can not believe that i just spent 2 days for this silly mistake (just an 'I'  made me crazy)

really appreciate your hawk eyes, thanks again :)
4 years ago
No problem. Glad it helped. :)
1 week ago
My solution for me was that in the IRepository <Payment Option>

The instance reference was to Nop.Core.Data and it should be to Nop.Data

I was like this for 2 days too