{"id":36865,"date":"2016-11-21T12:00:04","date_gmt":"2016-11-21T19:00:04","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/?p=8035"},"modified":"2016-11-21T12:00:04","modified_gmt":"2016-11-21T19:00:04","slug":"client-side-debugging-of-asp-net-projects-in-google-chrome","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/client-side-debugging-of-asp-net-projects-in-google-chrome\/","title":{"rendered":"Client-side debugging of ASP.NET projects in Google Chrome"},"content":{"rendered":"<p><strong>Updated 2017\/1\/3<\/strong> &#8211; Setting to control script debugging added. See below. <a href=\"https:\/\/www.visualstudio.com\/vs\/visual-studio-2017-rc\/\">Visual Studio 2017 RC<\/a> now supports client-side debugging of both JavaScript and TypeScript in Google Chrome. For years, it has been possible to debug both the backend .NET code and the client-side JavaScript code running in Internet Explorer at the same time. Unfortunately, the capability was limited solely to Internet Explorer. In Visual Studio 2017 RC that changes. You can now debug both JavaScript and TypeScript directly in Visual Studio when using Google Chrome as your browser of choice. All you should do is to select Chrome as your browser in Visual Studio and hit F5 to debug. If you\u2019re interested in giving us feedback on future features and ideas before we ship them, <a href=\"http:\/\/landinghub.visualstudio.com\/webdevtools\">join our community<\/a>. <a href=\"http:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2016\/11\/browser-selector.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2016\/11\/browser-selector-1.png\" alt=\"browser-selector\" width=\"667\" height=\"298\" class=\"alignnone size-full wp-image-8055\" \/><\/a> The first thing you\u2019ll notice when launching Chrome by hitting F5 in Visual Studio is a page that says, \u201cPlease wait while we attach\u2026\u201d. <a href=\"http:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2016\/11\/debugger-attach1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2016\/11\/debugger-attach1-1.png\" alt=\"debugger-attach\" width=\"521\" height=\"171\" class=\"alignnone size-full wp-image-8027\" \/><\/a> What happens is that Visual Studio is attaching to Chrome using the <a href=\"https:\/\/developer.chrome.com\/devtools\/docs\/debugger-protocol\">remote debugging protocol<\/a> and then redirects to the ASP.NET project URL (something like http:\/\/localhost:12345) after it attaches. After the attach is complete, the &#8220;Please wait while we attach&#8230;&#8221; message remains visible while the ASP.NET site starts up where normally you&#8217;d see a blank browser during this time. Once the debugger is attached, script debugging is now enabled for all JavaScript files in the project as well as all TypeScript files if there is source map information available. Here\u2019s a screen shot of a breakpoint being hit in a TypeScript file. <a href=\"http:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2016\/11\/breakpoint-hit.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2016\/11\/breakpoint-hit-1.png\" alt=\"breakpoint-hit\" width=\"356\" height=\"114\" class=\"alignnone size-full wp-image-8045\" \/><\/a> For TypeScript debugging you need to instruct the compiler to produce a .map file. You can do that by placing a tsconfig.json file in the root of your project and specify the a few properties, like so:<\/p>\n<pre>{\n  \"compileOnSave\": true,\n  \"compilerOptions\": {\n    \"sourceMap\": true\n  }\n}\n<\/pre>\n<p>If you\u00a0prefer to use Chrome\u2019s or IE\u2019s own dev tools to do client-side debugging,\u00a0the<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/updating-visual-studio-2017-release-candidate\/\">recent update to Visual Studio 2017 RC<\/a>\u00a0introduced a setting to disable the IE and Chrome script debugger (this will also prevent Chrome\/IE from closing after a debugging session ends). Go to <em>Tools -&gt; Options -&gt; Debugging -&gt; General<\/em> and turn off the setting <em>Enable JavaScript Debugging for ASP.NET (Chrome and IE)<\/em>. <img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/aspnet\/wp-content\/uploads\/sites\/16\/2016\/11\/debugger-settings-1-1024x690-1.png\" alt=\"debugger settings\" width=\"879\" height=\"592\" class=\"alignnone size-large wp-image-8855\" \/> We hope you\u2019ll enjoy this feature and we would love to hear your feedback in the comments section below, or <a href=\"https:\/\/twitter.com\/mkristensen\">via Twitter<\/a>. <a href=\"https:\/\/www.visualstudio.com\/vs\/visual-studio-2017-rc\/\">Download Visual Studio 2017 RC<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Updated 2017\/1\/3 &#8211; Setting to control script debugging added. See below. Visual Studio 2017 RC now supports client-side debugging of both JavaScript and TypeScript in Google Chrome. For years, it has been possible to debug both the backend .NET code and the client-side JavaScript code running in Internet Explorer at the same time. Unfortunately, the [&hellip;]<\/p>\n","protected":false},"author":398,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[322,7524],"class_list":["post-36865","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-debugging","tag-visual-studio-2017"],"acf":[],"blog_post_summary":"<p>Updated 2017\/1\/3 &#8211; Setting to control script debugging added. See below. Visual Studio 2017 RC now supports client-side debugging of both JavaScript and TypeScript in Google Chrome. For years, it has been possible to debug both the backend .NET code and the client-side JavaScript code running in Internet Explorer at the same time. Unfortunately, the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/36865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/398"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=36865"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/36865\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=36865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=36865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=36865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}