We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


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 IDebugExpressionContext2::ParseText returns this interface. IDebugStackFrame2::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.




Evaluates this expression asynchronously.


Ends asynchronous expression evaluation.


Evaluates this expression synchronously.

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

The SDM calls either IDebugExpression2::EvaluateSync or IDebugExpression2::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 IDebugExpressionEvaluator::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