3.80 -> 3.90 custom plugin causes unhandled exception

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi.
I have upgraded nopCommerce from 3.80 to 3.90. It works fine (it seems). But when I added custom plugin and tried to reload list of plugins I've got an exception:

Exception information: 
    Exception type: ComponentNotRegisteredException
    Exception message: The requested service 'System.String' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
   at Nop.Core.Infrastructure.DependencyManagement.ContainerManager.Resolve(Type type, ILifetimeScope scope) in P:\nopCommerce\Libraries\Nop.Core\Infrastructure\DependencyManagement\ContainerManager.cs:line 72
   at Nop.Core.Infrastructure.DependencyManagement.ContainerManager.ResolveUnregistered(Type type, ILifetimeScope scope) in P:\nopCommerce\Libraries\Nop.Core\Infrastructure\DependencyManagement\ContainerManager.cs:line 129
   at Nop.Core.Plugins.PluginDescriptor.Instance[T]() in P:\nopCommerce\Libraries\Nop.Core\Plugins\PluginDescriptor.cs:line 108
   at Nop.Core.Plugins.PluginFinder.<>c__8`1.<GetPlugins>b__8_0(PluginDescriptor p) in P:\nopCommerce\Libraries\Nop.Core\Plugins\PluginFinder.cs:line 144
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Nop.Services.Cms.WidgetService.LoadAllWidgets(Customer customer, Int32 storeId) in P:\nopCommerce\Libraries\Nop.Services\Cms\WidgetService.cs:line 90
   at Nop.Services.Cms.WidgetService.LoadActiveWidgets(Customer customer, Int32 storeId) in P:\nopCommerce\Libraries\Nop.Services\Cms\WidgetService.cs:line 48
   at Nop.Services.Cms.WidgetService.LoadActiveWidgetsByWidgetZone(String widgetZone, Customer customer, Int32 storeId) in P:\nopCommerce\Libraries\Nop.Services\Cms\WidgetService.cs:line 64
   at Nop.Admin.Controllers.WidgetController.WidgetsByZone(String widgetZone) in P:\nopCommerce\Presentation\Nop.Web\Administration\Controllers\WidgetController.cs:line 146
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.<Wrap>b__3()
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)



Request information:
    Request URL: http://localhost:5001/Admin/Plugin/List
    Request path: /Admin/Plugin/List
    User host address: ::1
    User: [email protected]
    Is authenticated: True
    Authentication Type: Forms
    Thread account name: STONE\ralfeus

Thread information:
    Thread ID: 15
    Thread account name: STONE\ralfeus
    Is impersonating: False
    Stack trace:    at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
   at Nop.Core.Infrastructure.DependencyManagement.ContainerManager.Resolve(Type type, ILifetimeScope scope) in P:\nopCommerce\Libraries\Nop.Core\Infrastructure\DependencyManagement\ContainerManager.cs:line 72
   at Nop.Core.Infrastructure.DependencyManagement.ContainerManager.ResolveUnregistered(Type type, ILifetimeScope scope) in P:\nopCommerce\Libraries\Nop.Core\Infrastructure\DependencyManagement\ContainerManager.cs:line 129
   at Nop.Core.Plugins.PluginDescriptor.Instance[T]() in P:\nopCommerce\Libraries\Nop.Core\Plugins\PluginDescriptor.cs:line 108
   at Nop.Core.Plugins.PluginFinder.<>c__8`1.<GetPlugins>b__8_0(PluginDescriptor p) in P:\nopCommerce\Libraries\Nop.Core\Plugins\PluginFinder.cs:line 144
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Nop.Services.Cms.WidgetService.LoadAllWidgets(Customer customer, Int32 storeId) in P:\nopCommerce\Libraries\Nop.Services\Cms\WidgetService.cs:line 90
   at Nop.Services.Cms.WidgetService.LoadActiveWidgets(Customer customer, Int32 storeId) in P:\nopCommerce\Libraries\Nop.Services\Cms\WidgetService.cs:line 48
   at Nop.Services.Cms.WidgetService.LoadActiveWidgetsByWidgetZone(String widgetZone, Customer customer, Int32 storeId) in P:\nopCommerce\Libraries\Nop.Services\Cms\WidgetService.cs:line 64
   at Nop.Admin.Controllers.WidgetController.WidgetsByZone(String widgetZone) in P:\nopCommerce\Presentation\Nop.Web\Administration\Controllers\WidgetController.cs:line 146
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.<Wrap>b__3()
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)


I can't find any information that would point to my plugin but it occurs only after I add plugin to Plugins folder and reloading list of plugins.
Could it be somehow related to the fact the plugin was installed previously?
6 years ago
ralfeus wrote:

But when I added custom plugin and tried to reload list of plugins I've got an exception


So, did you add custom plugin of newer version or old one?
If you've added older, please upgrade it.
6 years ago
This is my own plugin. I've compiled it with 3.90 version
6 years ago
According to your error stack you inject a "string" into your widget constructor (or dependant service). Not sure that it would work in 3.80 either. I presume you want to inject some existing service
6 years ago
No. That's my only constructor of IWidgetPlugin implementing class:

        public DepositPaymentProcessor(IWorkContext workContext, ICurrencyService currencyService)
        {
            this._workContext = workContext;
            this._currencyService = currencyService;
        }
6 years ago
Indeed the constructor above contained one more string parameter, which appeared after I restarted IDE. Thank you for the tip.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.