Your official information source from the .NET Web Development and Tools group at Microsoft.
A lot of people have asked about how to debug JScript in Visual Web Developer 2005. You need to know a few tricks before you can set a breakpoint on an ASPX document (Note that the experience is vastly improved in our Orcas March CTP and I will be making a separate blog post on that soon).
1. Enable client script debugging on IE:
2. Start debugging in Visual Web Developer (F5)
3. Bring up the Script Explorer window (Ctrl+Alt+N):
4. Once the Script Explorer window is opened, double click on the run-time document that you want to debug:
5. Now you can set a breakpoint in the run-time document:
The script execution will pause on the breakpoint when you execute the script. You can then examine objects at this point of the execution. For example, you can bring up the Quick Watch window and examine the data of the document object.
If you need to debug something during a page load, you can use the debugger statement:
Barry TangSoftware Design EngineerVisual Studio Web Tools
There is no "Script Window" under the "Windows" tab. How do you activate the "Script Window"? Do you need to install any software first?
There's no software needed, however you'll see the command appear once you're running your page (F5). We'll update the blog instructions.
There many and I mean MANY problems with script debugging inside VS. There is no solution to them as far as I have been able to tell after searchin the whole Internet back and forth.
The main problem is that more often than not the Script Explorer will just be empty.
No it's not the Script Explorer's fault. Even if you try to attach to an Internet Explorer process and have the html page opened and break points set, it still won't work. It is not a problem on my machine. I have seen it on different machines, on W2K, WXP, W2K3 on both VS 2003 and VS 2005.
There IS a problem. Common solutions you can find on the internet just don't work. Sometimes a restart helps but not always. Sometimes it works once and then stops. Sometimes it doesn't work just to start working with no apparent reason!
I have dropped this feature and use some crappy FireFox tools now. Yes they are crappy as can be, but at least they work!
As for the Script Explorer window option not being there, try Ctrl + Alt + N
I use both the script explorer and the debugger; statement.
Using debugger along with enabling script debugging in the browser seems to work quite well. Execution will stop at the debugger statement and then you can set break points and step through the code.
Jeff King made a recent post to show off the new JScript IntelliSense feature in the March CTP of Visual
When degugging is not working, even debugger; statement is not helping.
I'm pretty sure that this is not a Visual Studio problem but rather Internet Explorer's.
Internet Explorer should just be banned. It is beyond repair.