Javascript breakpoint not work in Visual Studio 2019 asp.net application

Tom Regan picture Tom Regan · Nov 1, 2019 · Viewed 15.2k times · Source

I recently upgraded from VS 2017 to VS 2019.

In VS 2017, when running an asp.net application locally, using Chrome, I could put a breakpoint in javascript code and the debugger would stop on the breakpoint. This no longer works in Visual Studio 2019.

What do I need to do to enable javascript debugging in Visual Studio 2019 using Chrome? I would like to be able to put breakpoints in javascript files and have them hit.

Here is my setup.

  1. I've enabled Javascript debugging. enter image description here

  2. I put a breakpoint in my Javscript code. This breakpoint is in a *.js file (not inside a Razor view).

enter image description here

  1. The breakpoint is ignored. Visual Studio very courteously shows me a tooltip telling me the breakpoint will be ignored.

enter image description here

Answer

LoLance picture LoLance · Nov 4, 2019

It should work in VS2019+Chrome.(I just checked this in several machines)

This is not one issue can be resolved directly since many factors can cause this behavior, you can follow suggestions below to check if it helps:

1.Update your VS2019 to latest 16.3.7, update your chrome browser to latest 78.0.3904.87

2.Delete the bin and obj folders in your project directory => then close and restart VS => open that project and do a clean rebuild

3.Make sure you're in debug project mode, right-click your web project=>Set as StartUp prroject

Also, sometimes we need to wait for several seconds before the debug session starts successfully.(I once met same popup, then after several seconds it disappeared and everything worked)

Hope it helps :)