The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at IDebugExpression2.

This interface represents a parsed expression ready for binding and evaluating.

IDebugExpression2 : IUnknown  

The debug engine (DE) implements this interface to represent a parsed expression ready to be evaluated.

A call to ParseText returns this interface. GetExpressionContext returns the IDebugExpressionContext2 interface. These interfaces are accessible only when the program being debugged has been paused and a stack frame is available.

The following table shows the methods of IDebugExpression2.

EvaluateAsyncEvaluates this expression asynchronously.
AbortEnds asynchronous expression evaluation.
EvaluateSyncEvaluates this expression synchronously.

When a program has halted, the session debug manager (SDM) obtains a stack frame from the DE with a call to EnumFrameInfo. The SDM then calls GetExpressionContext to get the IDebugExpressionContext2 interface. This is followed by a call to ParseText to create the IDebugExpression2 interface, which represents the parsed expression ready to be evaluated.

The SDM calls either EvaluateSync or EvaluateAsync to actually evaluate the expression and produce a value.

In an implementation of IDebugExpressionContext2::ParseText, the DE uses COM's CoCreateInstance function to instantiate an expression evaluator and get an IDebugExpressionEvaluator interface (see the Example in the IDebugExpressionEvaluator interface). The DE then calls Parse to obtain an IDebugParsedExpression interface. This interface is used in the implementation of IDebugExpression2::EvaluateSync and IDebugExpression2::EvaluateAsync to perform the evaluation.

Header: msdbg.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

Core Interfaces