Uninstalled plugin still being used

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
I have a custom plugin which has a custom implementation of ICustomerService. In the same plugin, I have a DependencyRegistrar that registers my custom CustomerService. All is working and dandy. However, after I uninstalled my plugin, my custom CustomerService is still being used by nopCommerce. I have to remove the plugin folder from the Presentation folder to stop it from being used but once I added the plugin folder back in and restart the application, it'll get picked up again by nopCommerce. Is this a normal behaviour?
9 years ago
ASP.NET will cache assemblies in memory.  After you uninstall, sometimes you may need to "touch" the web.config file to force ASP.NET to recompile  (add a blank line to end of file).

What version of nopCommerce do you have?
9 years ago
I'm using version 3.4

I don't think that is the case. During uninstallation, the plugin will remove some configuration stuff from the web.config.
9 years ago
If your plugin did not check for PluginDescriptor.Installed before running code, nopCommerce will still run the plugin code. As far as I know, plugins are loaded whether or not they are installed. This makes sense because to perform some plugin actions, we need the help of the plugin itself (for example Install method is written in the plugin itself). So even it is not installed, it has to be loaded. And because it is loaded, any methods that you've written will run, unless you check for PluginDescriptor.Installed explicitly. :)
9 years ago
Help me please over this topic..Sorry for posting in reply section.
https://www.nopcommerce.com/boards/t/32904/page-not-found-when-click-on-category-preview.aspx
9 years ago
wooncherk wrote:
If your plugin did not check for PluginDescriptor.Installed before running code, nopCommerce will still run the plugin code. As far as I know, plugins are loaded whether or not they are installed. This makes sense because to perform some plugin actions, we need the help of the plugin itself (for example Install method is written in the plugin itself). So even it is not installed, it has to be loaded. And because it is loaded, any methods that you've written will run, unless you check for PluginDescriptor.Installed explicitly. :)


Thanks for your insightful reply. Where do I use PluginDescriptor.Installed to check if my plugin is installed? In the DependencyRegistrar?
9 years ago
jason2k wrote:
If your plugin did not check for PluginDescriptor.Installed before running code, nopCommerce will still run the plugin code. As far as I know, plugins are loaded whether or not they are installed. This makes sense because to perform some plugin actions, we need the help of the plugin itself (for example Install method is written in the plugin itself). So even it is not installed, it has to be loaded. And because it is loaded, any methods that you've written will run, unless you check for PluginDescriptor.Installed explicitly. :)

Thanks for your insightful reply. Where do I use PluginDescriptor.Installed to check if my plugin is installed? In the DependencyRegistrar?


In all your methods that you want disabled when not installed. :)
9 years ago
wooncherk wrote:
If your plugin did not check for PluginDescriptor.Installed before running code, nopCommerce will still run the plugin code. As far as I know, plugins are loaded whether or not they are installed. This makes sense because to perform some plugin actions, we need the help of the plugin itself (for example Install method is written in the plugin itself). So even it is not installed, it has to be loaded. And because it is loaded, any methods that you've written will run, unless you check for PluginDescriptor.Installed explicitly. :)

Thanks for your insightful reply. Where do I use PluginDescriptor.Installed to check if my plugin is installed? In the DependencyRegistrar?

In all your methods that you want disabled when not installed. :)


I have many custom implementations (usually services) of the nopCommerce core interfaces. If I put PluginDescriptor.Installed on all the implementation member methods, they are exceptions being thrown because there is no fallback methods to serve the request when it is consumed by nopCommerce.

So I think I should go back to the point of origin, in preventing the implementations from ever being registered by the DependencyRegistrar's Register method if the plugin is not installed.

So my code for the DependencyRegistrar is something like

public class DependencyRegistrar : IDependencyRegistrar {
    public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder) {
        var pluginDescriptor = _pluginFinder.GetPluginDescriptorBySystemName("Misc.pluginname");

        if (pluginDescriptor != null) {
               //Register dependencies
        }
    }
}


So now the question is, how to resolve _pluginFinder? DependencyRegistrar doesn't support constructor injection.

Or do I use EngineContext.Current.Resolve<IPluginFinder>() to resolve it? But wouldn't this create a dependency on the IOC container which makes conducting unit testing more difficult? I've seen this used in Views which is okay since unit testing doesn't involve Views.
9 years ago
maybe the uninstall function is not correct
9 years ago
marcwagener wrote:
maybe the uninstall function is not correct


As been pointed out by @wooncherk, uninstalling a plugin doesn't prevent the assembly from being loaded.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.