Auto-expanding custom (and standard) types in the watch window

The default for complex types is to just display the type name in the debugger’s watch window. Some system types however display the values of one or more properties instead of the type name. What is displayed is configurable which also makes it possible to show more information about user-defined types. This is how it’s done:

  1. Edit C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\Debugger\mcee_cs.dat for C#, mcee_mc.dat for managed C++, vjsee.dat for J#. Sorry, no VB!
  2. Add/modify rows in the file. Each row describes how a type should be displayed. Example:
    <System.DateTime>=<Year>-<Month>-<Day> <Hour>:<Minute>:<Second>
  3. The first part is the type name, followed by ‘=’. The rest of the line contains property names surrounded with ‘< ' and '>‘, mixed with fixed text that is displayed as it is.

The example above will display DateTime values as "{2005-4-23 16:2:51}".

In addition to property names, one can also use expressions and method names.

1 thought on “Auto-expanding custom (and standard) types in the watch window”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.