开发者

Visual Studio 2010 debugging Javascript with IE works but not with firefox or chrome. Any solution?

I have been reading a lot of messages here at stack overflow and googling for some time without any luck. My problem is simple, I want to debug my application from v开发者_如何学Goisual studio using firefox or chrome, not IE, but I allways get same error at breakpoint when execute "Breakpoint will not currently be hit. No symbols have been loaded for this document". I have unchecked the disable script debugging in options, have added "debugger;" to the start of my javascript, but allways same error, Could anybody please help?

Thanks in advance, Mathew.


If you only want to debug Javascript, why not use Firebug in Firefox, and Developer tools in Chrome? These are the best JS debugging tools I ever knew.


My understanding is that you cannot.
You'll have to use IE as your browser when you want to use VS as your javascript debugging tool. It's a bit of a pain in vs2010 and earlier as you have to change your default browser that fires up when you start debugging; "Attach to process" from debug menu and "Wait for a request..." under Start Options of the Property Pages don't cut it.
Fortunately, the current release candidate of VS2012 have a convenient dropdown that allows you to choose a browser to start debugging with directly on the toolbar. It's a really nice touch and I doubt it will be going away in the RTM version.


As to the exact error you're getting, I've found that happen sometimes when not all libraries are loaded at the beginning of debugging - they're loaded later, on-demand. If you open Debug / Windows / Modules you'll find out what's been loaded, and whether the symbols have been loaded. A quick way around them not being loaded for debug is to instantiate the objects in question early on in the code, so that they're pre-loaded and the debugger knows that you're going to want to be debugging them.

For launching a particular browser: Instead of using the "Start URL" option from the Properties page / Web tab, use "Start External Program." Provide the full path to the browser's .exe of your choice, specify the Command Line Argument as appropriate (e.g., http://localhost/MyApp), and it'll start things off.

As to debugging the JS, though, I'd agree that Firebug is a good tool, and much more helpful than VS's.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜