ICLRDomainManager::SetAppDomainManagerType Method

Specifies the type, derived from the System.AppDomainManager class, of the application domain manager that will be used to initialize the default application domain.

Syntax

HRESULT SetAppDomainManagerType(  
    [in] LPCWSTR wszAppDomainManagerAssembly,  
    [in] LPCWSTR wszAppDomainManagerType,  
    [in] EInitializeNewDomainFlags dwInitializeDomainFlags  
);  

Parameters

wszAppDomainManagerAssembly
[in] The display name of the assembly that contains the application domain manager type; for example: "AdMgrExample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6856bccf150f00b3".

wszAppDomainManagerType
[in] The type name of the application domain manager, including the namespace.

dwInitializeDomainFlags
[in] A combination of EInitializeNewDomainFlags enumeration values that provide information about the application domain manager.

Return Value

This method returns the following specific HRESULTs as well as HRESULT errors that indicate method failure.

HRESULT Description
S_OK The method completed successfully.
HOST_E_CLRNOTAVAILABLE The common language runtime (CLR) has not been loaded into a process, or the CLR is in a state in which it cannot run managed code or process the call successfully.

Remarks

Currently, the only defined value for dwInitializeDomainFlags is eInitializeNewDomainFlags_NoSecurityChanges, which tells the common language runtime (CLR) that the application domain manager will not modify security settings during the execution of the AppDomainManager.InitializeNewDomain method. This allows the CLR to optimize the loading of assemblies that have the conditional AllowPartiallyTrustedCallersAttribute (APTCA) attribute. This can result in a significant improvement in startup time if the transitive closure of this set of assemblies is large.

Important

If the host specifies eInitializeNewDomainFlags_NoSecurityChanges for the application domain manager, an InvalidOperationException is thrown if any attempt is made to modify the security of the application domain.

Calling the ICLRControl::SetAppDomainManagerTypemethod is equivalent to calling ICLRDomainManager::SetAppDomainManagerType with eInitializeNewDomainFlags_None.

Requirements

Platforms: See System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 4

See also