Javascript breakpoints in Visual Studio 2017

后端 未结 12 2422
北荒
北荒 2020-12-05 04:14

I just installed Visual Studio 2017. After starting an ASP.NET MVC application I get the message that chrome debugging in Visual Studio is enabled.

But my breakpoint

相关标签:
12条回答
  • 2020-12-05 05:04

    For those who use Google Chrome Portable (or added chrome to browsers debug list manually) helps this:

    https://docs.microsoft.com/en-us/visualstudio/javascript/tutorial-nodejs-with-react-and-jsx?view=vs-2017#set-and-hit-a-breakpoint-in-the-client-side-react-code

    You need to attach then to proper chrome instance manually and viola

    0 讨论(0)
  • 2020-12-05 05:04

    I had the same situation Javascript break point were not hitting and then i uninstalled and reinstall visual studio 2017 and it started working again

    0 讨论(0)
  • 2020-12-05 05:05

    Another tip: js debug only can be enabled after setting 'start URL' on run/debug.

    Only in this way VS will attach to browser process.

    0 讨论(0)
  • 2020-12-05 05:06

    I had the same issue. I followed the instructions from the same post: https://blogs.msdn.microsoft.com/webdev/2016/11/21/client-side-debugging-of-asp-net-projects-in-google-chrome/

    I did the following in Visual Studio: Go to Tools -> Options -> Debugging -> General and turned off the setting "Enable JavaScript Debugging for ASP.NET (Chrome and IE)". Saved changes, then run the webpage.

    After this, I noticed that Chrome was not showing the "Debug webpage" before loading my page. Then i closed my webpage and stopped the debugging session.

    I re-enabled the "Enable Javascript Debugging for ASP.NET (Chrome and IE)" option, then run the webpage using IE, and it worked. The page stopped and the breakpoint showed up in my visual studio.

    0 讨论(0)
  • 2020-12-05 05:09

    I had the same issue, new to .net core, a solution that worked for me was to add debugger; at the top of the script:

    <script>
      debugger;
    
      -- rest of your jscript here
    </script>
    
    0 讨论(0)
  • 2020-12-05 05:10

    It does work in vs 2017 only with enabling option "Enable Javascript Debugging for ASP.NET (Chrome and IE)" and setting debugger; in js code in *.cshtml as well as *.js file

    0 讨论(0)
提交回复
热议问题