Partager via


ICorProfilerCallback::Shutdown Method

Notifies the profiler that the application is shutting down.

HRESULT Shutdown();

Remarks

The profiler code cannot safely call methods of the ICorProfilerInfo Interface interface after the Shutdown method is called. Any calls to ICorProfilerInfo Interface methods result in undefined behavior after the Shutdown method returns. Certain immutable events may still occur after shutdown; the profiler should take care to return immediately when this occurs.

The Shutdown method will be called only if the managed application that is being profiled started as managed code (that is, the initial frame on the process stack is managed). If the application started as unmanaged code but later jumped into managed code, thereby creating an instance of the common language runtime (CLR), then Shutdown will not be called. For these cases, the profiler should include in its library a DllMain routine that uses the DLL_PROCESS_DETACH value to free any resources and perform clean-up processing of its data, such as flushing traces to disk and so on.

In general, the profiler must cope with unexpected shutdowns. For example, a process might be halted by Win32's TerminateProcess method (declared in Winbase.h). In other cases, the CLR will halt certain managed threads (background threads) without delivering orderly destruction messages for them.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Reference

ICorProfilerCallback Interface