Share via


IDebugExpression2

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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

Syntax

IDebugExpression2 : IUnknown

Notes for Implementers

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

Notes for Callers

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.

Methods in Vtable Order

The following table shows the methods of IDebugExpression2.

Method Description
EvaluateAsync Evaluates this expression asynchronously.
Abort Ends asynchronous expression evaluation.
EvaluateSync Evaluates this expression synchronously.

Remarks

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.

Requirements

Header: msdbg.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

See also