Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 3.19 KB

expression-evaluator-implementation-strategy.md

File metadata and controls

28 lines (23 loc) · 3.19 KB
title description ms.date ms.topic helpviewer_keywords author ms.author manager ms.subservice
Expression Evaluator Implementation Strategy
Learn about a strategy for creating an expression evaluator by first implementing code to display local variables in the Locals window.
11/04/2016
conceptual
expression evaluation, implementation strategy
debug engines, implementation strategies
maiak
maiak
mijacobs
debug-diagnostics

Expression evaluator implementation strategy

Important

In Visual Studio 2015, this way of implementing expression evaluators is deprecated. For information about implementing CLR expression evaluators, see CLR expression evaluators and Managed expression evaluator sample.

One approach to rapidly creating an expression evaluator (EE) is to first implement the minimum code necessary to display local variables in the Locals window. It is useful to realize that each line in the Locals window displays the name, type, and value of a local variable, and that all three are represented by an IDebugProperty2 object. The name, type, and value of a local variable is obtained from an IDebugProperty2 object by calling its GetPropertyInfo method. For more information about how to display local variables in the Locals window, see Displaying locals.

Discussion

A possible implementation sequence starts with implementing IDebugExpressionEvaluator. The Parse and the GetMethodProperty methods must be implemented to display locals. Calling IDebugExpressionEvaluator::GetMethodProperty returns an IDebugProperty2 object that represents a method: that is, an IDebugMethodField object. Methods themselves are not displayed in the Locals window.

The EnumChildren method should be implemented next. The debug engine (DE) calls this method to get a list of local variables and arguments by passing IDebugProperty2::EnumChildren a guidFilter argument of guidFilterLocalsPlusArgs. IDebugProperty2::EnumChildren calls EnumArguments and EnumLocals, combining the results in a single enumeration. See Display locals for more details.

Related content