{"id":227679,"date":"2019-12-05T09:00:03","date_gmt":"2019-12-05T17:00:03","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=227679"},"modified":"2019-12-04T14:07:41","modified_gmt":"2019-12-04T22:07:41","slug":"pinnable-properties-debug-display-managed-objects-your-way","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/pinnable-properties-debug-display-managed-objects-your-way\/","title":{"rendered":"Pinnable Properties: Debug &#038; Display Managed Objects YOUR Way"},"content":{"rendered":"<p>A few months ago, I wrote a <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/customize-object-displays-in-the-visual-studio-debugger-your-way\/\">blog post about the DebuggerDisplay attribute<\/a>. This is a managed attribute that lets you customize how you view objects in debugging windows by \u201cfavoriting\u201d specific properties. Since that post, we\u2019ve streamlined DebuggerDisplay\u2019s behavior with Pinnable Properties, a new managed feature available for Visual Studio 16.4!<\/p>\n<p><em>Native developers: Fear not, <\/em><em>Pinnable<\/em><em> Properties will also be available for C++ in a later update!<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_227680\" aria-labelledby=\"figcaption_attachment_227680\" class=\"wp-caption alignnone\" ><img decoding=\"async\" class=\" wp-image-227680\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/12\/basic-pin.gif\" alt=\"Pinning a property in the Locals window\" width=\"1029\" height=\"450\" \/><figcaption id=\"figcaption_attachment_227680\" class=\"wp-caption-text\">Pinning a property<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>How does the Pinnable<\/strong><strong> Properties tool work?<\/strong><\/h3>\n<p>The Pinnable Properties tool is located in DataTips and the Autos, Locals, and Watch windows at debug time. To use the tool, hover over a property and select the toggle-able pin icon that appears or select the \u201cPin Member as Favorite\u201d option in the context menu. You will immediately see your selected members bubble to the top of your property list and appear in the Values column of any of the debugger inspection windows, replacing the default object type that is typically displayed. Now you can quickly identify and scan through your countless objects, greatly increasing your productivity.<\/p>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_227681\" aria-labelledby=\"figcaption_attachment_227681\" class=\"wp-caption alignnone\" ><img decoding=\"async\" class=\"wp-image-227681\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/12\/basic-pin_datatip.gif\" alt=\"Pinning properties in DataTips\" width=\"1042\" height=\"547\" \/><figcaption id=\"figcaption_attachment_227681\" class=\"wp-caption-text\">Pinning properties in DataTips<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<p>The properties you pin will persist across all your future debugging sessions until you decide to unpin them. Also, you can filter unpinned properties and hide property names via the Watch window toolbar or a DataTip context menu.<\/p>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_227682\" aria-labelledby=\"figcaption_attachment_227682\" class=\"wp-caption alignnone\" ><img decoding=\"async\" class=\" wp-image-227682\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/12\/filter-favorites.gif\" alt=\"Filter out unpinned properties\" width=\"1048\" height=\"458\" \/><figcaption id=\"figcaption_attachment_227682\" class=\"wp-caption-text\">Filter out unpinned properties<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_227683\" aria-labelledby=\"figcaption_attachment_227683\" class=\"wp-caption alignnone\" ><img decoding=\"async\" class=\" wp-image-227683\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/12\/toggle-property-names.gif\" alt=\"Toggle property names on and off with pinned properties\" width=\"1047\" height=\"458\" \/><figcaption id=\"figcaption_attachment_227683\" class=\"wp-caption-text\">Toggle pinned property names<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Why does the Pinnable Properties tool exist?<\/strong><\/h3>\n<p>Your feedback determined that there was high demand for quickly identifying objects in debugger windows via specific properties. Though DebuggerDisplay and Natvis can accomplish this task, they have several drawbacks that we observed and learned from you and other developers, including:<\/p>\n<ul>\n<li>having to modify your code to use the attribute<\/li>\n<li>the inability to use the attribute dynamically at debug time<\/li>\n<li>the lack of discoverability (I have been asked many times if DebuggerDisplay is a Visual Studio 2019 exclusive feature when it\u2019s been out for many, many years now\u2026)<\/li>\n<\/ul>\n<p>We created the Pinnable Properties tool to reduce these issues and provide with you with an easier, more intuitive, and real-time method to customize your object inspection experience without having to modify your code or override your ToString() method.<\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3><strong>Try out Pinnable Properties and give us even more feedback!<\/strong><\/h3>\n<p>Pinnable Properties would not have been possible without your enthusiasm and feedback for improving the existing DebuggerDisplay and Natvis behavior.\u00a0 We encourage you to try it out and share your thoughts on how we can make this tool even better in the comments or via <a href=\"https:\/\/www.research.net\/r\/LPRMT5N\">this survey<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Want to quickly identify objects by more than just their type while debugging? You can now pin object properties to the top of your debugger displays using the new Pinnable Properties tool in Visual Studio 2019 16.4!<\/p>\n","protected":false},"author":651,"featured_media":227685,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[237,85,5,1665,9,475],"class_list":["post-227679","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-net","tag-asp-net","tag-csharp","tag-debugging","tag-debug","tag-visual-studio-2019"],"acf":[],"blog_post_summary":"<p>Want to quickly identify objects by more than just their type while debugging? You can now pin object properties to the top of your debugger displays using the new Pinnable Properties tool in Visual Studio 2019 16.4!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/227679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/651"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=227679"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/227679\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/227685"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=227679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=227679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=227679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}