values displayed in VS debugger

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

In VS there are several types that are displayed differently in the 'watch'
window. For example, System.Drawing.Point is displayed in VS like this:
{X=4 Y=16}. While most types are simply displayed like this:
{System.Windows.Forms.TreeView}.

I want to know if this is coded into VS or if I can add/change the types
that display differently.

Thanks,
Chris
 
Chris,

In VS.NET 2005, the DebuggerDisplayAttribute will be supported by the
debugger. It will allow you to specify the format string you want, as well
as the properties that you want displayed in the format string. This
attribute, however, is overridable by the settings in VS.NET.

For the Point, the format string would be this:

"X={X} Y={Y}"

The property/field you want displayed is in the brackets.

Hope this helps.
 
I figured it out (for VS 2003 anyway). From the VS 2003 directory, go to
Common7\Packages\Debugger and open mcee_cs.dat in notepad. there is
documentation in that file for how to modify it. I've already added several
of them for my types. you have to restart VS to get them to work.

Chris
 
Never knew this was possible, its actually quite handy.

Nice!

- Joris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top