views:

40

answers:

2

I'm having a real problem trying to attach the JavaScript debugger in VS2008 to a web project. The web app is an ASP.NET MVC project but I don't think that should matter.

I'm using jQuery and have a .js file loaded when the page loads and in this .js file I call $(document).ready(function() { ... } and do some stuff and this "works." When I set a breakpoint it becomes disabled when I run the project through Cassini with the message "The breakpoint will not currently be hit. No symbols have been loaded for this document."

This error message is somewhat confusing because this is a javascript file so I would expect it to have a symbols file that could be loaded. i.e. a .pdb file that you would need to debug server side code. Or am I missing something here?

I found this post here: http://stackoverflow.com/questions/376384/using-breakpoints-to-debug-javascript-in-ie-and-vs2008 but that didn't help.

I've also tried a few other recommendations which involved attaching the browser from the debug menu after starting the debug session and I've tried doing this on IE x86, IE x64, and Firefox. If I add "debugger;" to my code then it will break in Firefox and let me step through the code in the Firefox debugger but I can't get it to do this in VS2008.

I'm running Win7 x64 Ultimate with VS2008 and the project is ASP.NET MVC with jQuery.

Any ideas?

A: 

Have you checked the "enable script debugging" option under tools (not sure what it's called, on a Mac right now) in IE?

Chris
Yes - both script debug options in IE are disabled.
Guy
If memory serves me correctly, they must be enabled for the JS debugging to work
Chris
They are phrased: "Disable script debugging..." so need to be unchecked. Slightly unintuitive to have the negative in there. I think we'd all find it easier if they'd said "Enable script debugging..." :)
Guy
+1  A: 

Hi,

have you tried debug the js file alone(put a debugger in code) by adding it to a blank html page?? and check whether it ll throw a script breakpoint exception and allow you to attach to VS 2008??

Cheers

Ramesh Vel

Ramesh Vel