Getting a licensing error when trying to create an instance of a .Net7 plugin

Hi,

I have a Delphi 10 Win32 application, with the latest version of Hydra, that is calling a .Net 7 module(which was converted from .Net Framework 4.8). I can load the module, but when trying to create a instance of the plugin, I’m getting the following error(when running from Visual Studio 2022):

System.ComponentModel.LicenseException: ‘An instance of type ‘FiloptoLicensingAPIPluginModule.FiloptoLicensingAPIPlugin’ was being created, and a valid license could not be granted for the type ‘RemObjects.Hydra.NonVisualPlugin’. Please, contact the manufacturer of the component for more information.’

There was no issues when it was under .Net Framework 4.8.

Any help would be appreciated.

Charles

Hi,

.Net 5+ doesn’t support .NET Framework licenses so you should remove licenses.licx from your project.

Check more at

Hi,

I’m still getting the error.

That file was already removed, because I couldn’t compile the module assembly with that file. Also, I ensured that all the referenced projects don’t have that file and that the referenced projects are all net7.0-windows. And, I’m using the Hydra NuGet package.

Any other suggestions on what to look for?

Charles

Hi,

Check my simple testcase from similar thread: Dotnet 5 non-visual plugin error calling from Delphi in hydra v6.6 - #2 by EvgenyK

it contains .NET6 plugin and Delphi host.

You can compare it with your plugin and see what is different

Hi,

Thanks, I did initially look at the sample, but I further paid attention to details that I might have missed. I was using THYModuleManager, but noticed that the sample was using THYSimpleModuleManager, that helped me further. The other issue was that .Net Publish was not replacing the existing RemObjects.Hydra assemblies that were in the folder(which were the .Net Framework versions), once I deleted those files to let the Publish put the correct ones in the folder, the Non-Visual Plugins worked.

Now, what is the best practice with regards to the .Net 7 WPF visual plugins. I do have some within the same module as the non-visual plugins. In the Delphi host, I was using THYModuleManager.CreateVisualPlugin, but now that the module is loaded with THYSimpleModuleManager, which doesn’t have CreateVisualPlugin. How do I create the visual plugin and host it inside a Delphi TPanel? Do you have a sample of a .Net 7 WPF visual plugin, that is used by a Delphi host? Also, looking at the help for the .Net5+ WPF visual plugin, there is no mention of the special wrapper class, is it still needed?

Hi,

THYSimpleModuleManager is designed for using with non-visual plugins in console app because it doesn’t require VCL or FMX frameworks.

In your case, you should use THYVCLSimpleModuleManager or THYModuleManager.

difference: 1st one is lightweight version of THYModuleManager that doesn’t provide support of IHYVCL* interfaces. it can be suitable for hosting cross-platform plugins. 2nd one is more suitable for hosting VCL plugins.

Of course, both of them will work with .NET 7 visual plugins

Thanks for the info, it works now.

1 Like