What can be the reasons for JavaScript breakpoint

2019-07-16 05:27发布

问题:

I set a breakpoint in a script block of a razor view.
VS2012 attaches to IE but breakpoint has yellow triangle with exclamation mark saying:

The breakpoint will not currently be hit. The code in the document is not loaded.

Script debugging is enabled in Internet Options of IE.

Have no idea what is wrong.

回答1:

I faced this problem too. After trying many codes and things take from different posts in Stackoverflow and others websites, they have not solve my problem. When i have take a look for @robert4 solution and go back in my javascript code, i saw one error and fixed it, by doing like that, i have finally solve may problem and can now get a breakpoint in my javascript document. For those who will face this type of problem, i think that the first thing to do it is to verify your js file code by code to see if there is no error before beginning to implement each of others solutions take from differents posts.



回答2:

When I had similar issue it turned out that an omitted } was the cause (in one of the JavaScripts of the page, one of the {}s was not closed). There was no error message on the browser console at all, just didn't work and I had no clue for half an hour. When I fixed the missing }, everything began to work as expected.