{"id":233918,"date":"2021-08-16T07:00:19","date_gmt":"2021-08-16T14:00:19","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=233918"},"modified":"2021-08-17T14:56:34","modified_gmt":"2021-08-17T21:56:34","slug":"debugging-external-sources-with-visual-studio","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/debugging-external-sources-with-visual-studio\/","title":{"rendered":"Debugging External Sources with Visual Studio"},"content":{"rendered":"<p>Have you ever needed to debug and step into a code of dependent NuGet or .NET libraries that do not build as part of your solution? Today, debugging through them is not so easy as debugging your projects that are part of your solution. Starting with Visual Studio 2022 Preview 3, we are adding a new &#8220;External Sources&#8221; node in the Solution Explorer which will make debugging external sources files much easier. This node appears while debugging and will show sources for managed modules with symbols loaded containing <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/standard\/library-guidance\/sourcelink\">Source Link<\/a> or <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/debug\/source-server-and-source-indexing&quot; \\l &quot;:~:text=Source%20Server%201%20Source%20Indexing.%20The%20source%20indexing,5%20Creating%20a%20Source%20Control%20Provider%20Module.%20\">Source Server<\/a> information. You can effortlessly browse those sources files and debug through them by placing breakpoints if needed.<\/p>\n<p>Visual Studio 2022\u00a0 team is working to deliver the promise of personal and team productivity. Debugging external sources is a capability in diagnostics tools that is just one of the exciting features we are working on.<\/p>\n<p><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\" target=\"_blank\">Download Visual Studio 2022 Preview<\/a><\/div><\/p>\n<h2>External Sources node in Solution Explorer<\/h2>\n<p>The feature adds a new top-level node to Solution Explorer, which appears when you are in a debugging session and any loaded <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/core\/diagnostics\/symbols\">symbol file<\/a> (.pdb) with Source Server information will appear under this node.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter wp-image-233919\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-15.png\" alt=\"In debug mode \u2013 collapsed state External Sources Node \" width=\"427\" height=\"254\" data-wp-editing=\"1\" \/><span style=\"font-size: 10pt;\">In debug mode \u2013 collapsed state (default)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter wp-image-233920\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-16.png\" alt=\"In debug mode \u2013 collapsed state External Sources Node with no symbols loaded \" width=\"477\" height=\"223\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-16.png 567w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-16-300x140.png 300w\" sizes=\"(max-width: 477px) 100vw, 477px\" \/><span style=\"font-size: 10pt;\">In debug mode \u2013 an expanded state with no modules with symbols <\/span><span style=\"font-size: 10pt;\">outside of the solution loaded<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter wp-image-233921\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-17.png\" alt=\"In debug mode \u2013 with one external module loaded and expanded\" width=\"505\" height=\"386\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-17.png 639w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-17-300x229.png 300w\" sizes=\"(max-width: 505px) 100vw, 505px\" \/><span style=\"font-size: 10pt;\">In debug mode \u2013 with one external module loaded and expanded<\/span><\/p>\n<p>You can browse for files by expanding the tree items. Then, double-click an item to download the file from Source Server and open it in the editor. The node will persist with the module sources across the debugging sessions if the modules are set to load symbols automatically.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter wp-image-233922\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-10.gif\" alt=\"Demo for External Sources\" width=\"635\" height=\"338\" \/><span style=\"font-size: 10pt;\">Demo for External Sources<\/span><\/p>\n<p>If you are working with applications with multiple external libraries which have their components published to Source Servers e.g. Newtonsoft.Json, CsvHelper, xUnit.net, etc. this feature will give you an easier way to browse those sources and debug through them if needed.<\/p>\n<h2><\/h2>\n<h2>Settings required<\/h2>\n<p>The Symbol loading and source downloading can be managed by options under debugging settings.<\/p>\n<p>Follow the settings checklist below to make sure modules can appear in Solution Explorer&#8217;s &#8220;External Sources&#8221; node.<\/p>\n<ol>\n<li>In the Tools -&gt; Options -&gt; Debugging options\n<ul style=\"list-style-type: square;\">\n<li>Disable Just My Code: This will allow the debugger to attempt to locate symbols for code outside your solution.<\/li>\n<\/ul>\n<\/li>\n<li>In the Tools -&gt; Options &gt; Debugging -&gt; Symbols options\n<ul style=\"list-style-type: square;\">\n<li>Enable Microsoft Symbol Server: This allows the debugger to attempt to locate symbols on Microsoft Symbol Server<\/li>\n<li>Enable NuGet.org Symbol Server: This allows the debugger to attempt to locate symbols on NuGet.org Symbol Server<\/li>\n<li>Enable Load All Modules: This allows the debugger to load symbols for all modules.\u00a0 \u00a0 \u00a0 \u00a0(Note these options will load all available symbols, you can restrict symbol loading by selecting &#8220;Load only specified modules&#8221; and specifying included modules.)<\/li>\n<\/ul>\n<\/li>\n<li>You may also need to check Debug -&gt; Windows -&gt; Modules to see which modules are currently loaded into memory and manually load any if required.<\/li>\n<li>You may be prompted to download the source from the server once you double-click the item in the &#8220;External Sources Node; click &#8220;Accept&#8221; and you can view the source code for that item in the editor.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter wp-image-233923\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/08\/word-image-11.gif\" alt=\"Demo for External Sources with manual symbol loading\" width=\"680\" height=\"372\" \/><span style=\"font-size: 10pt;\">Demo for External Sources with manual symbol loading<\/span><\/p>\n<h2>Let us know what you think!<\/h2>\n<p>This is the first step towards creating a first-class external source debugging experience for Visual Studio. We will soon be bringing this change for native code as well. We really appreciate you taking the time to try our newest feature and we hope you will provide your honest feedback by taking this brief survey.<a href=\"https:\/\/www.surveymonkey.com\/r\/9KYMZPL?sku=%5bsku_value%5d&amp;channel=%5bchannel_value%5d&amp;session=%5bsession_value%5d&amp;version=%5bversion_value%5d\"><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/www.surveymonkey.com\/r\/9KYMZPL?sku=%5bsku_value%5d&amp;channel=%5bchannel_value%5d&amp;session=%5bsession_value%5d&amp;version=%5bversion_value%5d\" target=\"_blank\">Share Your Feedback<\/a><\/div><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever needed to debug and step into a code of dependent NuGet or .NET libraries that do not build as part of your solution? Today, debugging through them is not so easy as debugging your projects that are part of your solution. Starting with Visual Studio 2022 Preview 3, we are adding a new &#8220;External Sources&#8221; node in the Solution Explo<\/p>\n","protected":false},"author":26573,"featured_media":233933,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[9,526,6815,6817],"class_list":["post-233918","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-debug","tag-productivity","tag-visual-studio-2022","tag-vs2022"],"acf":[],"blog_post_summary":"<p>Have you ever needed to debug and step into a code of dependent NuGet or .NET libraries that do not build as part of your solution? Today, debugging through them is not so easy as debugging your projects that are part of your solution. Starting with Visual Studio 2022 Preview 3, we are adding a new &#8220;External Sources&#8221; node in the Solution Explo<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/233918","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\/26573"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=233918"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/233918\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/233933"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=233918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=233918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=233918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}