HasShutdownStarted Property
Collapse the table of content
Expand the table of content

Environment.HasShutdownStarted Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a value indicating whether the common language runtime is shutting down or the current application domain is unloading.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public static bool HasShutdownStarted { get; }

Property Value

Type: System.Boolean
true if the common language runtime is shutting down or the current AppDomain is unloading; otherwise, false.
The current application domain is the AppDomain that contains the object that is calling HasShutdownStarted.

The finalization method for an object provides you an opportunity to perform any necessary cleanup operations before the object is garbage collected. After finalization, the object is accessible but in an invalid state and therefore unusable. Eventually, garbage collection completes and reclaims the object.

An object's finalization method is called in one of the following situations: during garbage collection, when the application domain that contains the object is unloaded, or when the common language runtime is shutting down.

While executing in your finalization method, you might want to access another object that is referenced by a static field and has a finalization method. However, you cannot reliably do so because the accessed object might already have been finalized.

Use this method in an object's finalization method to determine whether the common language runtime is shutting down or the application domain is unloading. If that is the case, you cannot reliably access any object that has a finalization method and is referenced by a static field.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft