0
votes
var plugins = Activator.CreateInstance(types.First()) as IPluginFinder;

This code stops with error in nopcommerce 4.10, These are that, In the previous version had no problem (4.00)

Full code:

var types = typeFinder.FindClassesOfType<IPluginFinder>();

if (types.Count() == 1)
{
    var plugins = Activator.CreateInstance(types.First()) as IPluginFinder;
    var currentPlugin = plugins.GetPluginDescriptorBySystemName("misc.myplugin");
    if (currentPlugin == null || currentPlugin.Installed == false)
        return;
}

Error: No parameterless constructor defined for this object

1

1 Answers

3
votes

With version 4.10 the PluginFinder class got a new constructor which needs a parameter of type IEventPublisher (see github commit). You will need to provide a value for that parameter. I don't know this product, but maybe you'll find something about that in the release notes or the docs.

IEventPublisher evtPub = ...; //
var plugins = Activator.CreateInstance(types.First(), evtPub) as IPluginFinder;