AppDomain.MonitoringIsEnabled Property

Definition

Gets or sets a value that indicates whether CPU and memory monitoring of application domains is enabled for the current process. Once monitoring is enabled for a process, it cannot be disabled.

C#
public static bool MonitoringIsEnabled { get; set; }
C#
public static bool MonitoringIsEnabled { [System.Security.SecurityCritical] get; [System.Security.SecurityCritical] set; }

Property Value

true if monitoring is enabled; otherwise false.

Attributes

Exceptions

The current process attempted to assign the value false to this property.

Remarks

This static property (Shared property in Visual Basic) controls CPU and memory monitoring of all the application domains in the process.

If you attempt to set this property to false, a ArgumentException exception is thrown, even if the current value of the property is false.

Once monitoring is enabled, you can use the MonitoringSurvivedMemorySize, MonitoringSurvivedProcessMemorySize, MonitoringTotalAllocatedMemorySize, and MonitoringTotalProcessorTime instance properties to monitor CPU and memory use of individual application domains.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also