{"id":5403,"date":"2007-09-28T19:04:07","date_gmt":"2007-09-28T19:04:07","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2007\/09\/28\/customizing-displays-in-the-debugger-for-system-types\/"},"modified":"2024-07-05T14:40:29","modified_gmt":"2024-07-05T21:40:29","slug":"customizing-displays-in-the-debugger-for-system-types","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/customizing-displays-in-the-debugger-for-system-types\/","title":{"rendered":"Customizing Displays in the Debugger for System Types"},"content":{"rendered":"<p>We&#8217;ve heard feedback from several customers regarding the way certain types are displayed in the Debugger.&nbsp; Many of the displays exist to maintain the user experience between versions of Visual Studio.&nbsp; We constantly evaluate if this is the correct choice for a given version of the product.&nbsp; <\/p>\n<p>Starting with VS2008, you don&#8217;t have to wait for us any longer.&nbsp; In VS2008, VB added full support for many of the debugging features it lacked compared to C# in 2005.&nbsp; In particular we&#8217;ve added full support for the <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/system.diagnostics.debuggerdisplayattribute.aspx\">DebuggerDisplayAttribute<\/a>.&nbsp; <\/p>\n<p>By attributing a class or member with this attribute you can control how it is displayed in the debugger.&nbsp; For each column (name, value and type) you can provide an alternate string or expression to display.&nbsp; <\/p>\n<p>The best part about this attribute is you can target types that exist in different libraries.&nbsp; You don&#8217;t even need the source for them.&nbsp; One of the members in the Type field which species the target type.&nbsp; Customizing a type in a separate library requires slightly more work than customizing a type you have the source for.&nbsp; For a source project you can just apply the attribute directly to the type or member and it will display.&nbsp; For a type in another library you need to do the following.  <\/p>\n<ul>\n<li>Define a class library and include all of the <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/system.diagnostics.debuggerdisplayattribute.aspx\">DebuggerDisplayAttribute<\/a> you want.&nbsp; Make sure to apply the attributes to the assembly and specify the <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/system.diagnostics.debuggerdisplayattribute.type.aspx\">Type<\/a> member.&nbsp; Ex.<\/li>\n<\/ul>\n<blockquote>\n<pre>&lt;Assembly: DebuggerDisplay(\"{ToString}\", Target:=GetType(Guid))&gt;<\/pre>\n<\/blockquote>\n<ul>\n<li>Place the built library under the folder &#8220;Visual Studio 2008\\Visualizers&#8221; which is under your my documents folder.&nbsp; <\/li>\n<\/ul>\n<p>After doing this any Guid type will now show up as the actual Guid String (&#8220;10f3c4eb-7c0f-41b1-ae83-8838ff2f4f70&#8221;) instead of {System.Guid}<\/p>\n<p>Jared <a title=\"http:\/\/blogs.msdn.com\/jaredpar\/\" href=\"http:\/\/blogs.msdn.com\/jaredpar\/\">http:\/\/blogs.msdn.com\/jaredpar\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve heard feedback from several customers regarding the way certain types are displayed in the Debugger.&nbsp; Many of the displays exist to maintain the user experience between versions of Visual Studio.&nbsp; We constantly evaluate if this is the correct choice for a given version of the product.&nbsp; Starting with VS2008, you don&#8217;t have to wait [&hellip;]<\/p>\n","protected":false},"author":260,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[192,195],"tags":[54,74,78,166],"class_list":["post-5403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-featured","category-visual-basic","tag-debugger","tag-ide","tag-jared-parsons","tag-vb2008"],"acf":[],"blog_post_summary":"<p>We&#8217;ve heard feedback from several customers regarding the way certain types are displayed in the Debugger.&nbsp; Many of the displays exist to maintain the user experience between versions of Visual Studio.&nbsp; We constantly evaluate if this is the correct choice for a given version of the product.&nbsp; Starting with VS2008, you don&#8217;t have to wait [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/5403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/260"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=5403"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/5403\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=5403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=5403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=5403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}