Good morning!
I’m creating a visual plugin on Visual Studio 2019 to Control on Delphi 10.2. But, I`m often getting this error, same as my main project.
Unable to instantiate managed plugin class. “PLuginHydra_Teste.UserControl1” Most likely the type is not declared as “public”, type or assembly are marked as ComVisible(false), or missing/incorrect license file is detected
Here the problem:
I created a Visual Hydra Plugin on Visual Studio 2019 and another project HydraUI_teste with a User Control that shows a bar.
Then I just compile the plugin and copy *.dll to Delphi project *.exe directory (Delphi 10.2).
In the projetct on Visual Studio (Hydra Plugin Project), if I put the instructions like this, it works good.
Visual Studio Project (Hydra Plugin)
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
In the other hand, if I instantiate the other project (Already imported in the plugin class). When i call it on Delphi, I get the error:
Visual Studio Project (Hydra Plugin)
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.fForm1 = new HydraUI_teste.FHydraUI(); /* Here */
}
Delphi Project:
HYModuleManager.LoadModule(path+'PluginHydra_Teste.dll');
HYModuleManager.CreateVisualPlugin('PluginHydra_Teste', fPluginHydra, pnlTeste); // Error Here
What I’ve checked:
- Assembly Hydra Plugin is setted to ComVisible(true) (Both Projects);
- The declared class is public on Visual Studio;
- The class that is instantiated is declared as public too;
public partial class FHydraUI : UserControl
{
public FHydraUI()
{
InitializeComponent();
}
}
- The licence file seem fine (already excluded obj files and recompiled).
Thank you.