Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Transitioning to Managed Hosting Code 

After loading and initializing the common language runtime, the host must make the transition from unmanaged to managed code in order to execute managed hosting code and user code. In earlier versions of the .NET Framework, managed hosting code is usually run in the default application domain, but the .NET Framework version 2.0 provides a base class, AppDomainManager, for implementing managed hosting code that is automatically loaded into every application domain created in the process.

The host sets its application domain manager, loads it into the default application domain, and obtains a pointer to its interface by calling IHostControl::SetAppDomainManager. The interface that is returned can be used to execute managed code. The designer of the host defines this interface, and thus is in a position to determine how much code is executed in the unmanaged host and how much is executed in the application domain manager.

NoteNote

In the .NET Framework versions 1.0 and 1.1, the host obtains an interface pointer to the default application domain by calling ICorRuntimeHost::GetDefaultDomain. The call returns an _AppDomain interface pointer to the instance of the AppDomain class that represents the default application domain. The host then uses the Load method of the AppDomain class to load the managed portion of the host into the default domain.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.