Implement type visualizers and custom viewers

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.

Type visualizers and custom viewers let a user view data of a particular type in a way that is more meaningful than a simple hexadecimal dump of numbers. An expression evaluator (EE) can associate custom viewers with specific types of data or variables. These custom viewers are implemented by the EE. The EE can also support external type visualizers, which might come from another third-party vendor or even the end user.

Discussion

Type visualizers

Visual Studio asks for a list of type visualizers and custom viewers for every object to be displayed in a watch window. An expression evaluator (EE) supplies such a list for every type for which it wants to support type visualizers and custom viewers. Calls to GetCustomViewerCount and GetCustomViewerList start the whole process of accessing type visualizers and custom viewers (see Visualizing and Viewing Data for details on the calling sequence).

Custom viewers

Custom viewers are implemented in the EE for a specific data type and are represented by the IDebugCustomViewer interface. A custom viewer is not as flexible as a type visualizer, since it is available only when the EE that implements that particular custom viewer is executing. Implementing a custom viewer is simpler than implementing support for type visualizers. However, supporting type visualizers gives maximum flexibility to the end user for visualizing their data. The remainder of this discussion concerns only type visualizers.

Interfaces

The EE implements the following interfaces to support type visualizers, to be consumed by Visual Studio: