Create multiple instances of plugin, using the same dll in different AppDomains

Hi There,

We have a Visual WPF plugin loaded from a dll, all works as expected with it and we are able to get it created into a new AppDomain. When attempting to create a new tab with a new instance of the same visual plugin, it is still referring to the previously created appdomain.

Is it possible to Load a Module (dll) into a new appdomain several times, keeping each instance of the plugin separated?

I have noted that this was asked in 2014 More than one instance of the same plugin, but was wondering if things have changed since then to permit this and if so, what would be the best way to do it? If it is not possible currently, are there any plans on adding support for it in the future?


it works with WPF sample:

can you create a simple testcase that reproduces this issue, pls?
you can send it to support@ for keeping privacy

Thanks, ill see if i can get a bare bones version working or adapt from the demo

Hi @EvgenyK,

Apologies for the long time to respond, priorities had changed and now the issue has resurfaced. I was wondering if you had that Sample to hand showing the 2 tabs? We are currently using version of Hydra.



you can load your plugin to another instance of THYModuleManager like

  HYModuleManager1.LoadModule(ExtractFilePath(Application.ExeName)+'Visualizer.dll',hcdNewAppDomain );
  HYModuleManager1.CreateVisualPlugin('Visualizer.Plugin', fVisualizer, pnl_Host);

  HYModuleManager2.LoadModule(ExtractFilePath(Application.ExeName)+'Visualizer.dll',hcdNewAppDomain );
  HYModuleManager2.CreateVisualPlugin('Visualizer.Plugin', fVisualizer2, panel5);
1 Like

Thank you very much for your assistance with this @EvgenyK. We were able to use the concept of multi Module Managers (that you suggested) for creating multiple app domains for distinct instances of our plugin successfully (not without massive headaches with AppDomain LoaderOptimizations of course).

I’ve marked that reply as the solution, albeit for anyone who does encounter issues with loading dll sharing, its advantageous to use MultiDomainHost as the optimization to ensure local libraries are not loaded into the SharedDomain (as opposed to MultiDomain which will) and locked by the first instance.