ICorDebugEval 介面ICorDebugEval Interface

提供方法讓偵錯工具執行所偵錯的程式碼內容中的程式碼。Provides methods to enable the debugger to execute code within the context of the code being debugged.


方法Method 描述Description
Abort 方法Abort Method 中止此 ICorDebugEval 物件目前正在執行的計算。Aborts the computation this ICorDebugEval object is currently performing.
CallFunction 方法CallFunction Method 設定指定之函數的呼叫。Sets up a call to the specified function. (在 .NET Framework 2.0 版中淘汰;請改用 ICorDebugEval2:: CallParameterizedFunction 。 ) (Obsolete in the .NET Framework version 2.0; use ICorDebugEval2::CallParameterizedFunction instead.)
CreateValue 方法CreateValue Method 取得指定類型之 "ICorDebugValue" 物件的介面指標,其初始值為零或 null。Gets an interface pointer to an "ICorDebugValue" object of the specified type, with an initial value of zero or null. (在 .NET Framework 2.0 中淘汰;請改用 ICorDebugEval2:: CreateValueForType 。 ) (Obsolete in the .NET Framework 2.0; use ICorDebugEval2::CreateValueForType instead.)
GetResult 方法GetResult Method 取得的介面指標 ICorDebugValue ,其中包含評估的結果。Gets an interface pointer to an ICorDebugValue that contains the results of the evaluation.
GetThread 方法GetThread Method 取得「ICorDebugThread」的介面指標,此評估正在執行或將會執行。Gets an interface pointer to the "ICorDebugThread" where this evaluation is executing or will execute.
IsActive 方法IsActive Method 取得值,這個值會指出這個 ICorDebugEval 物件目前是否正在執行。Gets a value that indicates whether this ICorDebugEval object is currently executing.
NewArray 方法NewArray Method 配置指定元素類型和維度的新陣列。Allocates a new array of the specified element type and dimensions. (在 .NET Framework 2.0 中淘汰;請改用 ICorDebugEval2:: NewParameterizedArray 。 ) (Obsolete in the .NET Framework 2.0; use ICorDebugEval2::NewParameterizedArray instead.)
NewObject 方法NewObject Method 配置新的物件實例,並呼叫指定的函式方法。Allocates a new object instance and calls the specified constructor method. (在 .NET Framework 2.0 中淘汰;請改用 ICorDebugEval2:: NewParameterizedObject 。 ) (Obsolete in the .NET Framework 2.0; use ICorDebugEval2::NewParameterizedObject instead.)
NewObjectNoConstructor 方法NewObjectNoConstructor Method 配置指定類型的新物件實例,而不嘗試呼叫函式方法。Allocates a new object instance of the specified type, without attempting to call a constructor method. (在 .NET Framework 2.0 中淘汰;請改用 ICorDebugEval2:: NewParameterizedObjectNoConstructor 。 ) (Obsolete in the .NET Framework 2.0; use ICorDebugEval2::NewParameterizedObjectNoConstructor instead.)
NewString 方法NewString Method 使用指定的內容配置新的字串物件。Allocates a new string object with the specified contents.


ICorDebugEval物件是在用來執行評估的特定執行緒內容中建立的。An ICorDebugEval object is created in the context of a specific thread that is used to perform the evaluations. 指定評估中使用的所有物件和類型都必須位於相同的應用程式域中。All objects and types used in a given evaluation must reside within the same application domain. 該應用程式域不需要與執行緒目前的應用程式域相同。That application domain need not be the same as the current application domain of the thread. 評估可以進行嵌套。Evaluations can be nested.

除非偵錯工具呼叫 ICorDebugController:: Continue,然後收到 ICorDebugManagedCallback:: EvalComplete 回呼,否則評估的作業不會完成。The evaluation's operations do not complete until the debugger calls ICorDebugController::Continue, and then receives an ICorDebugManagedCallback::EvalComplete callback. 如果您需要使用評估功能,而不允許其他執行緒執行,請在呼叫ICorDebugController:: Continue之前,使用ICorDebugController:: SetAllThreadsDebugStateICorDebugController:: Stop來暫停執行緒。If you need to use the evaluation functionality without allowing other threads to run, suspend the threads by using either ICorDebugController::SetAllThreadsDebugState or ICorDebugController::Stop before calling ICorDebugController::Continue.

因為正在進行評估時,使用者程式碼正在執行,所以可能會發生任何 debug 事件,包括類別載入和中斷點。Because user code is running when the evaluation is in progress, any debug events can occur, including class loads and breakpoints. 偵錯工具會如往常般接收這些事件的回呼。The debugger will receive callbacks, as normal, for these events. 評估的狀態將會顯示為檢查正常程式狀態的一部分。The state of the evaluation will be seen as part of the inspection of the normal program state. 堆疊鏈將會是 CHAIN_FUNC_EVAL 鏈 (請參閱 "CorDebugStepReason" 列舉和 ICorDebugChain:: GetReason 方法) 。The stack chain will be a CHAIN_FUNC_EVAL chain (see the "CorDebugStepReason" enumeration and the ICorDebugChain::GetReason method). 完整的偵錯工具 API 將繼續正常運作。The full debugger API will continue to operate as normal.

如果發生鎖死或無限迴圈的狀況,使用者程式碼可能永遠不會完成。If a deadlocked or infinite looping situation arises, the user code may never complete. 在這種情況下,您必須先呼叫 ICorDebugEval:: Abort ,然後再繼續此程式。In such a case, you must call ICorDebugEval::Abort before resuming the program.


這個介面不支援跨電腦或跨處理序的遠端呼叫。This interface does not support being called remotely, either cross-machine or cross-process.


平台: 請參閱 系統需求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

另請參閱See also