Mono Class Library: System.AppDomain Overview | Members

System.AppDomain.Unload Method

Unloads the specified application domain. [Edit]

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.MayCorruptAppDomain, System.Runtime.ConstrainedExecution.Cer.MayFail)]
public static void Unload (AppDomain domain)

Parameters

domain
A AppDomain representing the application domain to be unloaded. [Edit]

Exceptions

TypeReason
ArgumentNullExceptiondomain is null. [Edit]
CannotUnloadAppDomainExceptiondomain could not be unloaded. [Edit]

Remarks

If the thread that invoked AppDomain.Unload(AppDomain) is running in domain, another thread is started to perform the unload operation. If domain cannot be unloaded, a CannotUnloadAppDomainException is thrown in that thread, not the original thread that invoked AppDomain.Unload(AppDomain). However, if the thread that invoked AppDomain.Unload(AppDomain) is running outside domain, that is the thread that receives the exception.

The threads in domain are terminated using the System.Threading.Thread.Abort(object) method, which throws the thread an instance of System.Threading.ThreadAbortException.

Note: Although the thread should terminate promptly, it can continue executing for an unbounded amount of time in its finally clause.

[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0