ICorRuntimeHost::GetDefaultDomain is deprecated; how do I get the same result in undeprecated CLR hosting code

292 views Asked by At

This problem is about using wholly unmanaged C++ without using deprecated means.

I am hosting the CLR in C++ calling (in order):

  1. CLRCreateInstance to get an ICLRMetaHost* .
  2. The ICLRMetaHost method GetRuntime to get an ICLRRuntimeInfo* for v4.0.30319 .
  3. The ICLRRuntimeInfo method GetInterface to get an ICLRRuntimeHost* .
  4. The Start method of ICLRRuntimeHost to start the host.

Back in the day a different route would have produced a (now deprecated) ICorRuntimeHost* and the result of calling its GetDefaultDomain method would be used to get an _AppDomain* giving unmanaged access to the default AppDomain.

https://learn.microsoft.com/en-us/dotnet/api/system._appdomain

This _AppDomain* is what I want, but ICLRRuntimeHost has no analog of GetDefaultDomain.

The new arrangements for CLR hosting that don't use ICorRuntimeHost don't seem to support getting an _AppDomain* by any means I saw from searching online documentation.

How is the needed _AppDomain* obtained nowadays?

0

There are 0 answers