Default property display in debug windows

M

Michael Bray

I have a recollection that there is some way (an attribute on the class,
perhaps) that tells the VS.net debugger to display a particular property in
the Auto / Locals window when I'm viewing a particular type of object...

For example, if I have a class:

public class X
{
private int myValue = 1;

public string ToString()
{
return myValue.ToString();
}
}

if I have an instance of this class and I view it in the debugger with the
Auto / Locals window, I see the "Value" as {NameSpace.X}. What I want to
see there instead is "1" (or whatever myValue is). I thought there was an
attribute, but maybe it's something else... anyone know?

-mdb
 
M

Mattias Sjögren

Michael,
I have a recollection that there is some way (an attribute on the class,
perhaps) that tells the VS.net debugger to display a particular property in
the Auto / Locals window when I'm viewing a particular type of object...

System.Diagnostics.DebuggerDisplayAttribute in .NET 2.0


Mattias
 
M

MSDN

You are not overriding ToString()

oX.ToString() retruning the default ToString() in the base? the NameSpace.X

SA
 
M

Michael Bray

Michael,


System.Diagnostics.DebuggerDisplayAttribute in .NET 2.0

Ah thanks, but I should have specified... VS.net 2003. anything similar
or am I just out of luck?

-mdb
 
M

Mattias Sjögren

Ah thanks, but I should have specified... VS.net 2003. anything similar
or am I just out of luck?

IIRC, your options there are to override ToString or to modify the
<VSdir>\Common7\Packages\Debugger\mcee_cs.dat file.


Mattias
 
M

Michael Bray

IIRC, your options there are to override ToString or to modify the
<VSdir>\Common7\Packages\Debugger\mcee_cs.dat file.

I had already overriden ToString(), but modifying the mcee_cs.dat file
worked like a champ... In fact, I'm changing a whole bunch of stuff in
that file (now my DateTime's show hour/minute/second as well as
date/month/year!!! WWOOOOOOOHOOOOO!!!!!)

-mdb
 

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

Top