We are using the latest Hydra.net to load WPF modules in our delphi 7 app.
We have something like 10 WPF modules so we have decided to load them in separate app domain (new app domains).
Our problem is that the new app domain creation is very slow the first time the module is called (something like 3 seconds).
When the module has already been called one time, all the others calls are very quick.
Hydra.net doesn’t allow new app domain creation customization such as using MultiDomain option or changing app domain restrictions…
So, i’m trying to compile Hydra.net source code to be able to tweak the LoadManagedModule method but when i compile the sources using the latest Elements Trial in vs2015, i have this error at compile time :
Error (E90) Could not load public key ““RemObjectsSoftware”: Le jeu de clés n’existe pas. (Exception from HRESULT: 0x80090016)” RemObjects.Hydra
Why ? We have bought Hydra.Net with sources, so I don’t understand why i can’t compile this sources ?
You say that new app domains are created in the delphi part of Hydra source code ?
I don’t understand because App Domain is a dot net feature, not a delphi win32 feature…
In RemObjects.Hydra.Host project i have found this method :
method ModuleManager.LoadManagedModule(aFilename: string; aInNewAppDomain: boolean): LoadedManagedModule;
In this method the .net App Domain is created and can be customized with a LoaderOptimization.MultiDomain but this code seems to be never called ???
I don’t even deploy RemObjects.Hydra.Host.dll with my delphi main software and the hydra interface between delphi and .net works, i don’t understand anything…
It is not called because RemObjects.Hydra.Host is for .NET host apps while you have a Delphi host. Try to go step by step the the method that loads module in your host app and you’ll see the place where AppDomain is created.
Ok, in THYClrAppDomain.Create in uHYCLRWrappers.pas, i would like to set the LoaderOptimization property :
fAppDomainSetup := HYClr.CreateDomainSetup;
fAppDomainSetup.Set_ApplicationBase(BasePath);
fAppDomainSetup.Set_ApplicationName(AppName);
fAppDomainSetup.Set_LoaderOptimization(LoaderOptimization_MultiDomain); // line i have added
fAppDomain := HYClr.CreateDomain(AppName, fAppDomainSetup);
I have also added in uHYCLRmscorlib_TLB.pas :
IAppDomainSetup = interface(IUnknown)
[’{27FFF232-A7A8-40DD-8D4A-734AD59FCD41}’]
function Get_ApplicationBase(out pRetVal: WideString): HResult; stdcall;
function Set_ApplicationBase(const pRetVal: WideString): HResult; stdcall;
…
function Set_LoaderOptimization(const pRetVal: LoaderOptimization): HResult; stdcall; // line I have added
function Get_LoaderOptimization(out pRetVal: LoaderOptimization): HResult; stdcall; // line I have added
You cannot change anything in the uHYCLRmscorlib_TLB.pas file. It contains imported COM interfaces exposed by CLR.
UPD: This means that API we can use is somewhat limited. Atm I don’t see a way to set these options.
Could you try to update the .NET framework version used (in case you use .NET 3.5 for the plugin)? .NET FW 4.5+ has a lot of fixes in WPF