none
IHostAssemblyStore::ProvideAssembly() not being called for Host AppDomainManager assembly RRS feed

  • Question

  • Hi All,

    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.

    Is this supported?

    Many thanks,

    Rod da Silva

    Monday, December 22, 2014 6:37 PM

All replies

  • Hello Rod da Silva,

    In my opinion, I think it is not possible since as this IHostAssemblyStore::ProvideAssembly method already says:

    Gets a reference to an assembly that is not referenced by the ICLRAssemblyReferenceList that is returned from IHostAssemblyManager::GetNonHostStoreAssemblies.

    And in second case, you remove this type from the list, it then could not find the type anymore.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 23, 2014 6:30 AM
    Moderator
  • Fred,

    Thanks for the reply.  However, I don't agree.  As I understand it the IHostAssemblyManager:GetNonHostStoreAssemblies represents the list of assemblies you will let the CLR load into your Host on your behalf.  If i) an assembly needs loading, and ii) this list is supplied and iii) the assembly is not in the list, then the runtime is suppose to call your unmanaged host's  IHostAssemblyStore::ProvideAssembly() implementation to load it.   So if I leave the assembly out of yoru list, the CLR will not try to find it and instead ask your store to load it.  Indeed that, I believe, is the entire point.

    Others have reported that it does work (sort of).  In the link below the person indicates he gets the call back to the IHostAssemblyStore::ProvideAssembly() to load his managed AppDomainManager.  His problem coms after that....  I can't even seem to get the call happening however.

    http://stackoverflow.com/questions/9161463/can-appdomainmanager-be-loaded-by-provideassembly-from-a-clr-host

    Rod

    Tuesday, December 23, 2014 5:26 PM
  • Hello Rod,

    For this issue, I am trying to invoke someone experienced to help look into it, it should take some time and as soon as we get any result, we will post back.

    Regards & Thanks for your understanding.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, December 24, 2014 3:27 AM
    Moderator
  • 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=neutral, ProcessorArchitecture=MSIL",

    L" MyManagedAppDomainManager.MyAppDomainManager");

    I found this by turning Fusion log on.

    Hope this helps someone.

    Rod

    Friday, January 9, 2015 5:55 AM