Dotnet 5 non-visual plugin error calling from Delphi in hydra v6.6

Our current system using hydra v6.2 and using non-visual plugins created in dotnet framework for Delphi consumption. This has been working well.

Upgraded to Hydra v6.6 so we could create dotnet 5 plugins.
Installed ok, but none of the existing c# code or Hydra examples would compile. Seems that the GAC does not have the updated (v6.6) remobject dlls - should the Hydra installer do this?

Finally got the dotnet 5 plugin to compile (after registering new Remobject dlls in the GAC), and consuming from Delphi, now getting a runtime error
“Could not load file or assemlby Sytem.Runtime, Version 5.0.0.0”

Is this because I didn’t register the .comhost.dll ?
I tried that and got a registration error
“The module was loaded but the call to DllRegisterServer failed with error code 0x80008093”

Do you have any working examples of Delphi calling a dotnet 5 non-visual plugin?

Thanks,
Max.

Hi,

Have you read the NonVisual Plugins (.NET 5+) article ?

Just checked - 6.6.0.1309 is correctly installed to GAC.

we ship nuget package - C:\Program Files (x86)\RemObjects Software\Packages\RemObjects.Hydra.6.6.0.1309.nupkg. it contains all required dll for .NET 5+ plugins.

Check this example -
testcase.zip (17.8 KB)

Note: it uses .NET 6 because .NET 5 in VS2022 is deprecated but you can easily change it to .NET 5 if you are using VS2019.

Hi,

Yes I had been following the NonVisual Plugins to get things working.

Thanks for the testcase files - after a couple of changes managed to get Delphi calling a dotnet 6 plugin.
Couple of things I just wanted to check

There are some differences calling dotnet 6 plugins to our framework plugins

1/ license.licx doesn’t appear to be required in the dotnet project ?
2/ To load the module in Delphi I can’t use moduleManager.TryLoadModule(‘module.dll’), I have to use moduleManager.LoadComModule(‘’) ? Is this because the COM registration is not automated like it is for dotnet framework?

I also get an error registering the COM dll
eg running $env:systemroot\SysWow64\regsvr32.exe /i PluginSample.comhost.dll
generates an error “The Module PluginSample.comhost.dll” was loaded but the entry-point DllInstall was not found"
Delphi can still load the module via COM, so the registration must have worked.

Cheers,
Max.

Hi,

License Compiler was never ported into the .NET Core world

You can use LoadModule(s)/TryLoadModule methods, but it finally call LoadComModule

function THYBaseModuleManager.LoadModule(const aFileName: string;
  const aDefaultDomain: THYClrDomain = hcdNewAppDomain): Integer;
begin
  case GetExecutableType(aFilename) of
..
    etCOM:            Result := LoadComModule(aFileName);

use regsvr32 w/o /i parameter as described in article

Hi,

Thanks for all your help - got things going now.
One last thing …

Running the “import interfaces from .NET assemblies” command from Delphi on the dotnet 6 dll imports the assembly interfaces ok, but inherits the interfaces from IHYCrossPlatformInterface
eg IHydraInterface = interface(IHYCrossPlatformInterface)

This creates an access violation in Delphi when trying to call that interface.
I found I had to change it to just IHydraInterface = interface (without the inheritance) to get it to work.

Is this import interfaces command not intended for dotnet core dlls?

Cheers,
Max.

Hi,

I’ve updated
testcase.zip (127.0 KB)

changes:

  • .NET side:
    [Guid("7270A2DC-AEC4-460F-B652-886068D85592")]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] //<<<<<<
    public interface ISum : IHYCrossPlatformInterface
    {
        int Sum(int a, int b);
    }

If you import this plugin via import interfaces from .NET assemblies, it will work as expected.

Hi,

I have manged to get a working Delphi ↔ Hydra Dotnet 6 system working.
Wen to set it up on a similar (to my host machine) Windows 11 VM for testing, but running into registration issues …

executing &$env:systemroot\syswow64\regsvr32.exe hydraserver.comhost.dll
gives the following err

The Module “.\HydraServer.comhost.dll” was loaded but the call to DLLRegisterServer failed with error code 0x80008083

I then tried to install the dotnet 6 runtimes in case it requires these - still the same error
Error seems to be related to dotnet core behaviour

Any ideas?

Cheers,
Max.

Hi,

have you launched regsvr32 with admin rights?

Hi,

Yes, using admin powershell.

I have also tried using the RegFree option which also works on my host pc, but again doesn’t work on my VM.
There must be some configuration missing on the VM, or some dependency that isn’t satisfied.

Cheers,
MAx.

Hi,

from ErrorCode = ‘0x80004005 : 80008083: .Net Core 2.0 + IIS exception – Neel Bhatt :

0x80008083 – code for version conflict.

I think, it should give to you some hint why it was failed

Thanks,
Yeah it seems like it is related to dotnet 6 somehow…
I have the exact same dotnet 6 sdk and runtimes installed on the host and VM, both are windows 11 64bit.
Must be some other configuration issue …

Hi,

Try to compare dependence assemblies of your plugin on both pc with ILSpy.
Probably, you can see differences