Contains values that are used to specify behavior, capabilities, or events to which the profiler wishes to subscribe.


typedef enum {  
    COR_PRF_MONITOR_NONE                = 0x00000000,  
    COR_PRF_MONITOR_CLASS_LOADS         = 0x00000002,  
    COR_PRF_MONITOR_MODULE_LOADS        = 0x00000004,  
    COR_PRF_MONITOR_ASSEMBLY_LOADS      = 0x00000008,  
    COR_PRF_MONITOR_APPDOMAIN_LOADS     = 0x00000010,  
    COR_PRF_MONITOR_JIT_COMPILATION     = 0x00000020,  
    COR_PRF_MONITOR_EXCEPTIONS          = 0x00000040,  
    COR_PRF_MONITOR_GC                  = 0x00000080,  
    COR_PRF_MONITOR_THREADS             = 0x00000200,  
    COR_PRF_MONITOR_REMOTING            = 0x00000400,  
    COR_PRF_MONITOR_ENTERLEAVE          = 0x00001000,  
    COR_PRF_MONITOR_CCW                 = 0x00002000,  
    COR_PRF_MONITOR_REMOTING_COOKIE     = 0x00004000 |   
    COR_PRF_MONITOR_REMOTING_ASYNC      = 0x00008000 |   
    COR_PRF_MONITOR_SUSPENDS            = 0x00010000,  
    COR_PRF_MONITOR_CACHE_SEARCHES      = 0x00020000,  
    COR_PRF_ENABLE_REJIT                = 0x00040000,  
    COR_PRF_ENABLE_INPROC_DEBUGGING     = 0x00080000,  
    COR_PRF_ENABLE_JIT_MAPS             = 0x00100000,  
    COR_PRF_DISABLE_INLINING            = 0x00200000,  
    COR_PRF_DISABLE_OPTIMIZATIONS       = 0x00400000,  
    COR_PRF_ENABLE_OBJECT_ALLOCATED     = 0x00800000,  
    COR_PRF_MONITOR_CLR_EXCEPTIONS      = 0x01000000,  
    COR_PRF_MONITOR_ALL                 = 0x0107FFFF,  
    COR_PRF_ENABLE_FUNCTION_ARGS        = 0X02000000,  
    COR_PRF_ENABLE_FUNCTION_RETVAL      = 0X04000000,  
    COR_PRF_ENABLE_FRAME_INFO           = 0X08000000,  
    COR_PRF_ENABLE_STACK_SNAPSHOT       = 0X10000000,  
    COR_PRF_USE_PROFILE_IMAGES          = 0x20000000,  
                                        = 0x40000000,  
    COR_PRF_DISABLE_ALL_NGEN_IMAGES     = 0x80000000,  
    COR_PRF_ALL                         = 0x8FFFFFFF,  
                                          COR_PRF_MONITOR_CODE_TRANSITIONS |   
                                          COR_PRF_MONITOR_MODULE_LOADS |  
                                          COR_PRF_MONITOR_ASSEMBLY_LOADS |  
                                          COR_PRF_MONITOR_APPDOMAIN_LOADS |  
                                          COR_PRF_ENABLE_STACK_SNAPSHOT |  
                                          COR_PRF_MONITOR_GC |  
                                          COR_PRF_MONITOR_SUSPENDS |  
                                          COR_PRF_MONITOR_CLASS_LOADS |  
                                          COR_PRF_MONITOR_REMOTING |  
                                          COR_PRF_MONITOR_REMOTING_COOKIE |  
                                          COR_PRF_MONITOR_REMOTING_ASYNC |  
                                          COR_PRF_ENABLE_REJIT |  
                                          COR_PRF_ENABLE_INPROC_DEBUGGING |  
                                          COR_PRF_ENABLE_JIT_MAPS |  
                                          COR_PRF_DISABLE_OPTIMIZATIONS |  
                                          COR_PRF_DISABLE_INLINING |  
                                          COR_PRF_ENABLE_OBJECT_ALLOCATED |  
                                          COR_PRF_ENABLE_FUNCTION_ARGS |  
                                          COR_PRF_ENABLE_FUNCTION_RETVAL |  
                                          COR_PRF_ENABLE_FRAME_INFO |  
                                          COR_PRF_USE_PROFILE_IMAGES |  


The following sections list COR_PRF_MONITOR enumeration members by category. The categories are:

No flags set

Member Description
COR_PRF_MONITOR_NONE No flags are set.

Callback flags

Member Description
COR_PRF_MONITOR_ALL Enables all callback events.
COR_PRF_MONITOR_APPDOMAIN_LOADS Controls the AppDomainCreation* and AppDomainShutdown* callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_ASSEMBLY_LOADS Controls the AssemblyLoad* and AssemblyUnload* callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_CACHE_SEARCHES Controls the JITCachedFunctionSearch* callbacks in the ICorProfilerCallback interface.

The behavior of this flag is changed in the .NET Framework version 2.0.
COR_PRF_MONITOR_CCW Controls the COMClassicVTable* callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_CLASS_LOADS Controls the ClassLoad* and ClassUnload* callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_CLR_EXCEPTIONS Controls the ExceptionCLRCatcher* callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_CODE_TRANSITIONS Controls the UnmanagedToManagedTransition and ManagedToUnmanagedTransition callbacks in the ICorProfilerCallback interface
COR_PRF_MONITOR_ENTERLEAVE Controls the FunctionEnter*, FunctionLeave*, and FunctionTailCall*profiling global static functions.
COR_PRF_MONITOR_EXCEPTIONS Controls the ExceptionThrown callback and the ExceptionSearch*, ExceptionOSHandler*, ExceptionUnwind*, and ExceptionCatcher* callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_FUNCTION_UNLOADS Controls the FunctionUnloadStarted callback in the ICorProfilerCallback interface.
COR_PRF_MONITOR_GC Controls the GarbageCollectionStarted, GarbageCollectionFinished, MovedReferences, MovedReferences2, SurvivingReferences, SurvivingReferences2, ObjectReferences, ObjectsAllocatedByClass, RootReferences, RootReferences2, HandleCreated, HandleDestroyed, and FinalizeableObjectQueued callbacks in the ICorProfilerCallback* interfaces.
COR_PRF_MONITOR_JIT_COMPILATION Controls the JITCompilation*, JITFunctionPitched, and JITInlining callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_MODULE_LOADS Controls the ModuleLoad*, ModuleUnload*, and ModuleAttachedToAssembly callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_OBJECT_ALLOCATED Controls the ObjectAllocated callback in the ICorProfilerCallback interface.
COR_PRF_MONITOR_REMOTING Controls the Remoting* callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_REMOTING_ASYNC Controls whether the Remoting* callbacks will monitor asynchronous events.
COR_PRF_MONITOR_REMOTING_COOKIE Controls whether a cookie is passed to the Remoting* callbacks.
COR_PRF_MONITOR_SUSPENDS Controls the RuntimeSuspend*, RuntimeResume*, RuntimeThreadSuspended, and RuntimeThreadResumed callbacks in the ICorProfilerCallback interface.
COR_PRF_MONITOR_THREADS Controls the ThreadCreated, ThreadDestroyed, ThreadAssignedToOSThread, and ThreadNameChanged callbacks in the ICorProfilerCallback and ICorProfilerCallback2 interfaces.

Feature-enabling flags

Member Description
COR_PRF_ENABLE_FRAME_INFO Enables the retrieval of an exact ClassID for a generic function by calling the GetFunctionInfo2 method with a COR_PRF_FRAME_INFO value returned by the FunctionEnter2 callback.
COR_PRF_ENABLE_FUNCTION_ARGS Enables argument tracing using the FunctionEnter2 callback or the FunctionEnter3WithInfo callback and the GetFunctionEnter3Info method.
COR_PRF_ENABLE_FUNCTION_RETVAL Enables tracing of return values by using the FunctionLeave2 callback or the FunctionLeave3WithInfo callback and GetFunctionLeave3Info method.

In process debugging is not supported. This flag has no effect.

Allows the profiler to obtain IL-to-native maps by using GetILToNativeMapping. Starting with the .NET Framework 2.0, the runtime always tracks IL-to-native maps; therefore, this flag is always considered to be set.
COR_PRF_ENABLE_OBJECT_ALLOCATED Informs the runtime that the profiler may want object allocation notifications. This flag must be set during initialization. It allows the profiler to subsequently use the COR_PRF_MONITOR_OBJECT_ALLOCATED flag to receive ObjectAllocated callbacks.
COR_PRF_ENABLE_REJIT Enables calls to the RequestReJIT and RequestRevert methods. The profiler must set this flag on startup. If the profiler specifies this flag, it must also specify COR_PRF_DISABLE_ALL_NGEN_IMAGES.
COR_PRF_ENABLE_STACK_SNAPSHOT Enables calls to the DoStackSnapshot method.

Configuration flags

Member Description
COR_PRF_DISABLE_ALL_NGEN_IMAGES Prevents all native images (including profiler-enhanced images) from loading. If this flag and the COR_PRF_USE_PROFILE_IMAGES flag are both specified, COR_PRF_DISABLE_ALL_NGEN_IMAGES is used.
COR_PRF_DISABLE_INLINING Disables all inlining.
COR_PRF_DISABLE_OPTIMIZATIONS Disables all code optimizations.
COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST Disables security transparency checks that are normally done during just-in-time (JIT) compilation and class loading for full-trust assemblies. This can make some instrumentation easier to perform.
COR_PRF_USE_PROFILE_IMAGES Causes the native image search to look for profiler-enhanced images. If no profiler-enhanced image is found for a given assembly, the common language runtime falls back to JIT for that assembly. If this flag and the COR_PRF_DISABLE_ALL_NGEN_IMAGES flag are both specified, COR_PRF_DISABLE_ALL_NGEN_IMAGES is used.

Composite flags

Member Description
COR_PRF_ALL Represents all COR_PRF_MONITOR flag values.
COR_PRF_ALLOWABLE_AFTER_ATTACH Represents all COR_PRF_MONITOR flags that can be set after the profiler is attached to a running app. The syntax section indicates the individual flags that are present in this bitmask.
COR_PRF_MONITOR_ALL Enables all callback events.
COR_PRF_MONITOR_IMMUTABLE Represents all COR_PRF_MONITOR flags that can be set only during initialization. Trying to change any of these flags after initialization returns an HRESULT value that indicates failure.
COR_PRF_REQUIRE_PROFILE_IMAGE Represents all COR_PRF_MONITOR flags that require profile-enhanced images.


A COR_PRF_MONITOR value is used with the ICorProfilerInfo::GetEventMask and ICorProfilerInfo::SetEventMask methods to define the event notifications that the common language runtime makes to the profiler.


Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 1.0

See Also

Profiling Enumerations
GetEventMask Method
SetEventMask Method