Consuming event by not installed plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi
I have a plugin, which has event consumer. The plugin isn't installed but binaries are present in store's site plugins directory.
While trying to perform an operation, which fires consumed event (in my case - creation the order) I get an exception:

Nop.Services.Events.IConsumer`1[[Nop.Core.Domain.Orders.OrderPlacedEvent, Nop.Core, Version=3.9.0.0, Culture=neutral, PublicKeyToken=null]], Nop.Services.Events.IConsumer`1[[Nop.Core.Domain.Orders.OrderPaidEvent, Nop.Core, Version=3.9.0.0, Culture=neutral, PublicKeyToken=null]]], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope
  ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Nop.Plugin.Ralfeus.Agent.Infrastructure.EventsConsumer' can be invoked with the available services and parameters: Cannot resolve parameter 'Nop.Plugin.Ralfeus.Agent.Services.IAgentOrderService agentOrderService' of constructor 'Void .ctor(Nop.Plugin.Ralfeus.Agent.Services.IAgentOrderService, Nop.Services.Catalog.IProductAttributeFormatter, Nop.Services.Orders.IOrderService, Nop.Services.Events.IEventPublisher, Nop.Plugin.Ralfeus.Agent.AgentSettings, Nop.Services.Directory.ICurrencyService, Nop.Core.IWorkContext)'.

I understand it's caused by loading all assemblies regardless of whether plugins installed or not. Is there any way to prevent not instaled plugin assemblies being loaded besides removing plugin folder?
6 years ago
You have to remove plugin folder.  Unfortunately, nopCommerce needs to load the assembly just to call its Install.  Plugin developers (especially those handling events) should be sure to check that they are "installed" before executing their functionality,
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.