all groups > visual studio .net debugging > september 2006 >
You're in the

visual studio .net debugging

group:

Value and Type in Locals debug window


Value and Type in Locals debug window SNORBERG
9/15/2006 7:44:02 AM
visual studio .net debugging:
Since in the Locals debug window the Value and the Type are the same for
classes , I would like to be able to display the "value" of the class in the
value column.

I have tried overriding ToString, but that would have been too easy. Is
there a way to do this? I don't even know where to start looking.

Re: Value and Type in Locals debug window Oleg Starodumov
9/18/2006 12:00:00 AM

[quoted text, click to view]

It depends on the debugger version.

For VS2003, take a look at mcee_cs.dat file
(in <vsinstalldir>\Common7\Packages\Debugger).
Instructions are inside of the file itself.

For VS2005, you can use ToString and a number of attributes
(DebuggerDisplay, DebuggerBrowsable, DebuggerTypeProxy),
as well as visualizers. They are all described in the debugger
documentation.

--
Oleg
[VC++ MVP http://www.debuginfo.com/]


Re: Value and Type in Locals debug window SNORBERG
9/18/2006 3:42:01 PM
According to the DebuggerDisplay documentation
"If a C# object has an overridden ToString(), the debugger will call the
override and show its result instead of the standard {<typeName>}. "

We have overriden ToString but only the typename shows in the value column.

We are using C# with VS2005.

[quoted text, click to view]
Re: Value and Type in Locals debug window SNORBERG
9/18/2006 4:38:02 PM
Thanks Oleg,

That was the pointer I needed

Scott

[quoted text, click to view]
Re: Value and Type in Locals debug window Oleg Starodumov
9/19/2006 12:00:00 AM

[quoted text, click to view]

Probably the following option is disabled:

Tools | Options | Debugging | General | "Call ToString() on objects in variables windows (C# only)"

Oleg



AddThis Social Bookmark Button