Hello,
We are using several .net (c# with WPF) modules in a Delphi 7 application with the help of Hydra 4.0.71.1093.
We are loading modules by using the following code :
FHYModuleManager := THYModuleManager.Create(nil);
FHYModuleManager.ResolveInterfacesToOwner := False;
FHYModuleManager.CustomImplementer := Self;
FHYModuleManager.OnBeforeUnloadModule := OnBeforeUnloadModule;
FLog.LogMsgParam(’**** Loading HYDRA dll for %s %s ****’, [FName, FHydraPluginPath], logInfo);
HYModuleManager.LoadModule(FHydraPluginPath, True);
We want all modules to load into a new separated AppDomain.
When our delphi app is being closed by user, we destroy Hydra modules by using following code :
try
FHYModuleManager.CustomImplementer := nil;
FHYModuleManager.UnloadModule(FHydraPluginPath);
FHYModuleManager:= nil;
except
on E: Exception do
begin
FLog.LogMsgParam(‘Failed to free Hydra module : %s’, [E.Message], logError);
end;
end;
When this code is executed on our developer machines, AppDomain unloads correctly without any AppDomain Unload errors.
Some of our clients (that are using our software from the morning to the evening, everyday) sometimes have an exception when unloading Hydra modules (Failed to free Hydra module : OLE error 80131015) which is a .net AppDomainUnloadedException.
We are not able to reproduce this issue on our dev machines, but some of our clients have the problem after a few hours of use (not all the time, seems to be random)
Is it possible to get an access of the AppDomainUnloadedException exception (stacktrace) to be able to have the exception details and to have the exception telling us why the unload domain failed ???
Thanks for your help, we are getting crazy since 2 weeks with this problem !
Frederic