ICorDebugThread::GetCurrentException 方法ICorDebugThread::GetCurrentException Method

取得 ICorDebugValue 物件的介面指標,該物件代表 managed 程式碼目前正在擲回的例外狀況。Gets an interface pointer to an ICorDebugValue object that represents an exception that is currently being thrown by managed code.


HRESULT GetCurrentException (  
    [out] ICorDebugValue **ppExceptionObject  


擴展物件位址的指標 ICorDebugValue ,該物件代表 managed 程式碼目前擲回的例外狀況。[out] A pointer to the address of an ICorDebugValue object that represents the exception that is currently being thrown by managed code.


例外狀況物件將存在於擲回例外狀況的時間,直到區塊結束為止 catchThe exception object will exist from the time the exception is thrown until the end of the catch block. 函數評估(由 ICorDebugEval 方法執行)將會清除安裝程式上的例外狀況物件,並在完成時將其還原。A function evaluation, which is performed by the ICorDebugEval methods, will clear out the exception object on setup and restore it on completion.

例外狀況可以是嵌套 (例如,如果在篩選中擲回例外狀況,或在函式評估) 中擲回例外狀況,因此單一線程上可能會有多個未處理的例外狀況。Exceptions can be nested (for example, if an exception is thrown in a filter or in a function evaluation), so there may be multiple outstanding exceptions on a single thread. GetCurrentException 傳回最新的例外狀況。GetCurrentException returns the most current exception.

例外狀況物件和類型可能會在例外狀況的整個存留期間變更。The exception object and type may change throughout the life of the exception. 例如,在擲回 x 類型的例外狀況之後,common language runtime (CLR) 可能會用盡記憶體,並將其升級為記憶體不足的例外狀況。For example, after an exception of type x is thrown, the common language runtime (CLR) may run out of memory and promote it to an out-of-memory exception.


平台: 請參閱 系統需求Platforms: See System Requirements.

標頭: CorDebug.idl、CorDebug.hHeader: CorDebug.idl, CorDebug.h

程式庫: CorGuids.libLibrary: CorGuids.lib

.NET Framework 版本:自 1.0 起可用Available since 1.0.NET Framework Versions: 自 1.0 起可用Available since 1.0