.NET Framework Class Library
AppDomainManagerInitializeNewDomain Method

Initializes the new application domain.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)
Public Overridable Sub InitializeNewDomain ( _
	appDomainInfo As [%$TOPIC/77eb2e8x_en-us_VS_110_1_0_0_0_0%] _
public virtual void InitializeNewDomain(
	[%$TOPIC/77eb2e8x_en-us_VS_110_1_0_1_0_0%] appDomainInfo
virtual void InitializeNewDomain(
	[%$TOPIC/77eb2e8x_en-us_VS_110_1_0_2_0_0%]^ appDomainInfo
abstract InitializeNewDomain : 
        appDomainInfo:[%$TOPIC/77eb2e8x_en-us_VS_110_1_0_3_0_0%] -> unit  
override InitializeNewDomain : 
        appDomainInfo:[%$TOPIC/77eb2e8x_en-us_VS_110_1_0_3_0_1%] -> unit


Type: SystemAppDomainSetup

An object that contains application domain initialization information.

Important noteImportant

Do not use this method to initialize an application domain in ASP.NET. In ASP.NET, configuration must be handled by the host. If you use this method to initialize the application domain, the host throws InvalidOperationException when it attempts to initialize the application domain. The exception message indicates that initialization has already occurred.

This method is called immediately after the constructor. The default InitializeNewDomain implementation does nothing. A custom implementation can set up internal classes and delegates, set up an interface with the unmanaged host interface, or set up event handlers for the new AppDomain.

Also, for add-in activations, a custom implementation could identify the current AppDomain as the target application domain.

Beginning with the .NET Framework 4, you can use this method to sandbox the default application domain at application startup, or to modify the sandbox of a new application domain. To do this, adjust the DefaultGrantSet and FullTrustAssemblies properties on the ApplicationTrust object that is assigned to the AppDomainSetupApplicationTrust property of appDomainInfo, before you initialize the application domain.


Only assemblies granted FullTrust, such as assemblies in the global assembly cache or identified as fullTrustAssemblies in the AppDomainCreateDomain(String, Evidence, AppDomainSetup, PermissionSet, StrongName) method can be loaded in the AppDomainManager constructor and the InitializeNewDomain method.


The following example shows an override of the InitializeNewDomain method for a custom application domain manager. This code example is part of a larger example provided for the AppDomainManager class.

Public Overrides Sub InitializeNewDomain(ByVal appDomainInfo _
    As AppDomainSetup) 
    Console.Write("Initialize new domain called:  ")
    InitializationFlags = _
End Sub 'InitializeNewDomain
public override void InitializeNewDomain(AppDomainSetup appDomainInfo)
    Console.Write("Initialize new domain called:  ");
    InitializationFlags = 
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.