Javascript breakpoints in Visual Studio 2017

后端 未结 12 2447
北荒
北荒 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:02

    This feature does not work for javascript code inside a *.cshtml file, but only for code in separate *.js (or *.ts) files.

    Notice how the breakpoint in the JavaScript file is active, while the breakpoint in the Razor view is not.

    I have also noticed that breakpoints will not be hit for JavaScript files when JavaScript code is executed during page load when the page is loaded the first time in the current Chrome session. Breakpoints will only work after the document has finished loading once.

提交回复
热议问题