Reputation: 5529
I'm trying to debug JavaScript in Visual Studio 2008. I use ASP.NET MVC, jQuery, and jQueryUI.
I can set a breakpoint, but when I start debugging Visual Studio changes the breakpoint icon to one with a warning. Hovering over the icon then reveals a tooltip which says:
"The breakpoint will not currently be hit. The document is not loaded."
In IE8, I have "Disable Script Debugging" unchecked for both IE and other browsers.
My JavaScript code is very simple and not dynamically generated. What am I missing?
Upvotes: 0
Views: 684
Reputation: 22717
Try typing the code "debugger;" in the place where you want the breakpoint. When IE hits that line, it should stop whether a debugger is attached or not.
Visual Studio will do what you described during startup, since the code isn't being run yet. Are you sure that the code has been loaded into the browser when you're looking at the debugger? If the code has already run and it still shows the document as not loaded, then you could be placing the breakpoint in the wrong version of the file. (VS will create temporary documents for some JavaScript during debugging, if you put breakpoints there during one debug session, they won't work for the next debug session.)
Edit
If you are working with a "web application" project, you should also check the web.config file to make sure you have debugging enabled.
Upvotes: 2