Export (0) Print
Expand All
1 out of 7 rated this helpful - Rate this topic

Debugging JScript with Visual Studio 

Some JScript programs are designed to run from the command line, while others are designed to run in an ASP.NET page. The type of program influences the debugging method.

Procedures

To set up debugging for a command line program

  1. Compile the program that you intend to debug using the /debug flag. For more information, see /debug.

  2. Start Microsoft Visual Studio.

  3. From the File Menu, click Open, and then click Project.

  4. In the Open Project dialog box, browse to your compiled program (the file with the .exe extension), select it and click Open.

  5. From the File Menu, click Open, and then click File.

  6. In the Open File dialog box, browse to your source code (the file with the .js extension), select it and click Open.

  7. From the File menu, click Save All.

  8. Choose a name and location to save your new project.

After this setup is complete, you can proceed to the Debugging using Visual Studio section.

To set up debugging for an ASP.NET program

  1. Start Microsoft Visual Studio.

  2. Open the ASP.NET file that you intend to debug.

  3. Set the debug flag to true in the @page directive. For example:

    <%@page Language=jscript debug=true %>
    
  4. Open the page in a browser to compile the page.

  5. From the Visual Studio Tools menu, click Debug Processes.

  6. In the Processes dialog box, select the Show system processes and Show processes in all sessions options.

  7. In the Available Processes pane of the Processes dialog box, select the ASP.NET worker process that runs that Web application, and click Attach.

    By default, the worker process is aspnet_wp.exe for IIS 5.x (on Windows 2000 and Windows XP), and w3wp.exe for IIS 6.0 (on Windows Server 2003).

  8. In the Attach to Process dialog box, select Common Language Runtime and click Ok.

  9. In the Processes dialog box, click Close.

After this setup is complete, you can proceed to the Debugging using Visual Studio section.

To debug using Visual Studio

  1. In the Visual Studio IDE, open the file that you intend to debug, as described in either of the above setup sections.

  2. Move the cursor to the location in the file where you want to set a breakpoint, and press F9.

  3. Repeat the previous step to add more breakpoints.

  4. From the Debug menu, click Start.

    The program will run until it encounters a breakpoint or produces a runtime error.

  5. At this point, several windows will open, allowing you to perform further debugging tasks. For more information, see Debugger Roadmap.

  6. To stop debugging but leave the program running, from the Debug menu, choose Detach All.

    Otherwise, the program will be terminated when you stop debugging.

Remarks

When debugging program compiled from the command line, Visual Studio rereads the compiled program each time you start debugging. Consequently, you can modify your JScript code and (after recompiling the code) check the effect of those changes.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.