Welcome to MSDN Blogs Sign in | Join | Help

jaredpar's WebLog

Code, rants and ramblings of a programmer.

Syndication

News

Now Reading

Expert F#

What's a better book to read when learning F#?

Essential WPF

Thus far the best book I've read on WPF. Gets right down to working with WPF and the goals/history.

Purely Functional Data Structures

Reading this book makes me feel like I'm back in college. It will really get your mind going and is best read with a whiteboard handy.


Customizing Displays in the Debugger for System Types

We've heard feedback from several customers regarding the way certain types are displayed in the Debugger.  Many of the displays exist to maintain the user experience between versions of Visual Studio.  We constantly evaluate if this is the correct choice for a given version of the product. 

Starting with VS2008, you don't have to wait for us any longer.  In VS2008, VB added full support for many of the debugging features it lacked compared to C# in 2005.  In particular we've added full support for the DebuggerDisplayAttribute

By attributing a class or member with this attribute you can control how it is displayed in the debugger.  For each column (name, value and type) you can provide an alternate string or expression to display. 

The best part about this attribute is you can target types that exist in different libraries.  You don't even need the source for them.  One of the members in the Type field which species the target type.  Customizing a type in a separate library requires slightly more work than customizing a type you have the source for.  For a source project you can just apply the attribute directly to the type or member and it will display.  For a type in another library you need to do the following.

  • Define a class library and include all of the DebuggerDisplayAttribute you want.  Make sure to apply the attributes to the assembly and specify the Type member.  Ex.
<Assembly: DebuggerDisplay("{ToString}", Target:=GetType(Guid))>
  • Place the built library under the folder "Visual Studio 2008\Visualizers" which is under your my documents folder. 

After doing this any Guid type will now show up as the actual Guid String ("10f3c4eb-7c0f-41b1-ae83-8838ff2f4f70") instead of {System.Guid}

Published Friday, September 28, 2007 4:32 PM by Jared Parsons

Filed under: ,

Comments

# Techy News Blog &raquo; Customzing Displays in the Debugger for System Types @ Friday, September 28, 2007 4:50 PM

PingBack from http://www.artofbam.com/wordpress/?p=3746

Techy News Blog » Customzing Displays in the Debugger for System Types

New Comments to this post are disabled
Page view tracker