Provides methods that are used by the common language runtime (CLR) to notify a code profiler when the events to which the profiler has subscribed occur. The ICorProfilerCallback2 interface is an extension of the ICorProfilerCallback interface. That is, it provides new callbacks introduced in the .NET Framework version 2.0.
Each method implementation must return an HRESULT having a value of S_OK on success or E_FAIL on failure. Currently, the CLR ignores the HRESULT that is returned by each callback except ICorProfilerCallback::ObjectReferences.
Notifies the code profiler that an object with a finalizer has been queued to the finalizer thread for execution of its Finalize method.
Notifies the profiler that a garbage collection has completed and all garbage collection callbacks have been issued for it.
Notifies the code profiler that a garbage collection has started.
Notifies the code profiler that a garbage collection handle has been created.
Notifies the code profiler that a garbage collection handle has been destroyed.
Notifies the profiler about root references after a garbage collection has occurred. This method is an extension of the ICorProfilerCallback::RootReferences method.
Notifies the profiler about object references that have survived a garbage collection.
Notifies the code profiler that the name of a thread has changed.
The CLR calls a method in the ICorProfilerCallback (or ) interface to notify the profiler when an event, to which the profiler had subscribed, occurs. This is the primary callback interface through which the CLR communicates with the code profiler.
A code profiler must implement the methods of the ICorProfilerCallback interface. For the .NET Framework 2.0 and later versions, the profiler must also implement the ICorProfilerCallback2 methods. Each method implementation must return an HRESULT having a value of S_OK on success or E_FAIL on failure. Currently, the CLR ignores the HRESULT that is returned by each callback except ICorProfilerCallback::ObjectReferences.
A code profiler must register in the Microsoft Windows registry, its COM object that implements the ICorProfilerCallback and ICorProfilerCallback2 interfaces. A code profiler subscribes to the events for which it wants to receive notification by calling ICorProfilerInfo::SetEventMask. This is usually done in the profiler's implementation of ICorProfilerCallback::Initialize. The profiler is then able to receive notification from the runtime when an event is about to occur or has just occurred in an executing runtime process.
The profiler registers a single COM object. If the profiler is targeting .NET Framework version 1.0 or 1.1, that COM object need only implement the methods of ICorProfilerCallback. If it is targeting .NET Framework version 2.0 and later, the COM object must also implement the methods of ICorProfilerCallback2.
Platforms: See .NET Framework System Requirements.
Header: CorProf.idl, CorProf.h
.NET Framework Versions: 4.6, 4.5.2, 4.5.1, 4.5, 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0