can not hit breakpoint inside of .js file

25,124

Solution 1

Turn your user account control settings off!

If that doesn't work, create a new application (don't change anything!). Make sure JavaScript debugging is enabled in Internet Explorer.

If that doesn't work, then make sure JavaScript is enabled in the current Internet Security Zone (IE Options).

Solution 2

You can use debugger for hitting your code. Just write

debugger;

before the line you want to debug and this will work.I think this will make your life easy.

Solution 3

By using Visual Studio 2015, I found that breakpoints will only work when you run your project in internet explorer.

It will neither work for Firefox nor Chrome.

For Firefox you can use the Firebug (Firefox's plugin) to debug JavaScript as shown below:

enter image description here

Solution 4

One thing to check would be the property pages of your project to make sure your debugger type is Script Only. Just right-click on the project in the Solution Explorer and check the Debugging page.

enter image description here

Solution 5

Try to put your breakpoint in the very first instruction of your JavaScript file, your breakpoint is probably in a code which is not reached.

Share:
25,124
jim
Author by

jim

Updated on July 09, 2022

Comments

  • jim
    jim almost 2 years

    I upgraded to win 8. Now I run my VS 2012 under admin privileges and I'm creating a website in MVC 4. I checked different solutions online and none have worked. I have a javascript file in my solution but when I put a breakpoint in it, at runtime I see "no symbols have been loaded for this document". I had this issue couple years back with VS 2008 and somehow it resolved. I don't remember if I did change anything at all. Now it's back! except i'm not on win XP and VS 2008. the .pdb files are in place (bin\Debug), script debugging is enabled in internet options, and I can debug my c# code without any problem. totally the same situation I've been into back in 2008. whatever this is, is all about javascript since this happens for inline javascript too!

    the strange part is that the js code is running but I just can't debug it in vs 2012.

    I already know the workaround, which is using f12 tools or anything similar. That's not the case here, I had VS 2012 on win 7 two weeks ago and I was debugging my js in VS itself without any problems. this is the same installation, so it must be win 8 related.

    So how can I solve this?