Easy JavaScript Debugging With Visual Studio
6/13/2008
Web, Visual Studio
(0)
A couple of days ago, I ranted on how difficult it was to debug JavaScript in your applications. I'm going to have to take that back though, I discovered something today that makes everything super simple.
First things is first, you must uncheck "Disable script debugging" from the Advanced tab in your Internet Options.
Then go into the JavaScript code that you'd like to debug and add the keyword "debugger" to where you want to start your debugging from.
Now when you run your application and your JavaScript is called, you'll get sent back into the Visual Studio debugger and you can step through code, set breakpoints, etc, just like you were debugging server-side code.
Another nice feature along with this debugging is that it brings up a view of how the source code for your page looks and makes it easy to check values of controls on the page. I can see this as hugely beneficial when it comes to creating customized AJAX applications.
I really wish I had known about this earlier, it would have saved me a ton of headaches. Hopefully this blog post will save others the pain I so needlessly endured. The issues I talked about in my previous blog still apply to trying to debug from IE, but using this method you debug right out of Visual Studio itself (I tested this on Visual Studio 2005, I can't say for certain which other versions it works on or if it works the same on them).
I should also credit the page where I found this info, which you can find right here. Thanks Steve!
0" style="disp
This article has been view 625 times.
|