1

I am building an unmanaged CLR Host and have a very specific question regarding the loading of my managed AppDomainManager assembly via an unmanaged IHostAssemblyStore implementation. Specifically I can't seem to get the CLR to load my AppDomainManager assembly through my IHostAssemblyManager component.

I specify my AppDomain Manager type on the ICLRControl interface as I am supposed to:

...

hr = pCLRControl ->SetAppDomainManagerType(L"MyManagedAppDomainManager, Version=1.0.0.0, PublicKeyToken=9ab418b2d23c1abd, ProcessorArchitecture=MSIL",

L" MyManagedAppDomainManager.MyAppDomainManager");

...

If I include this type in the list of assemblies returned by IHostAssemblyManager::GetNonHostStoreAsemblies(), the CLR looks for the assembly/type in my application directory, finds it and loads it no problem.

However, if I remove this type from the non-host store assemblies list, the above line throws a C++ EEFileLoadException error. I don't expect this. I expect my IHostAssemlbyStore::ProvideAssembly() implementation to get called to provide the assembly, and it doesn't.

Note that in the first case (where I include the assembly in the non-host store assemblies list), once my AppDomainManager assembly loads, all other assemblies not specified in the list are redirected to my IHostAssemblyStore::ProvideAssembly() implementation as they are supposed to be. I just can't seem to get the CLR to call this method for the AppDomainManager assembly itself.

Does anybody know how to get an unmanaged CLR Host to load the AppDomainManager assembly through IHostAssemblyStore::ProvideAssembly()?

  • Take a look at http://stackoverflow.com/q/9161463/863564 – Lorenzo Dematté Dec 27 '14 at 11:13
  • Lorenzo Thanks for the reply, I have seen that post and it confirms its possible but I don't see what I am doing wrong. My code should work. As mentioned my IHostAssebmlyStore::ProviderAssembly() is being called for all assemblies my host loads except for my managed AppDomainManager assembly. It loads from my app's directory if it is included in the IHostAssebmlyMansager::GetNonHostStoreAssemblies() list, otherwise the CLR doesn't load. Do you know of a CLR sample that shows how to load a simply AppDomainManager assembly via IHostAssemblyStore::ProvideAssembly()? Thanks, – Rod da Silva Dec 28 '14 at 22:19

1 Answers1

1

Update:

I found the issue: I was missing the "Culture" portion of the assembly name:

hr = pCLRControl ->SetAppDomainManagerType(L"MyManagedAppDomainManager, Version=1.0.0.0, PublicKeyToken=9ab418b2d23c1abd, Culture=nueutral, ProcessorArchitecture=MSIL",

L" MyManagedAppDomainManager.MyAppDomainManager");

I found this by turning Fusion Log on.

Hope this helps someone else.

Rod