BUG: Debugger skips client-side breakpoints in ASP.NET projects (317094)



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework) 1.0
  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition

This article was previously published under Q317094

SYMPTOMS

Visual Studio ASP.NET projects allow you to set breakpoints in either server-side or client-side code. However, when you start to debug, the debugger does not stop at client-side breakpoints in the ASP.NET project.

RESOLUTION

To work around this problem, follow these steps:
  1. Enable debugging in your browser. To do this in Microsoft Internet Explorer 6.0, follow these steps:
    1. On the Tools menu, click Internet Options.
    2. On the Advanced tab, clear the Disable script debugging check box, and then click OK.
  2. Insert a stop or a debugger statement in your client-side code. In Microsoft Visual Basic Scripting Editing (VBScript), use the stop statement. In JScript, use the debugger statement.

    The following code illustrates how to use these statements in the OnLoad event:
    'VBScript
    Sub window_onload
        stop
        'Insert onload code here.
    End Sub
    
    
    //JScript
    function window_onload() {
        debugger;
        //Insert onload code here.
    }
    When your browser reaches the stop or the debugger statement, the browser invokes the debugger (Visual Studio) to enter debug mode. If you have multiple debuggers installed on the computer, the browser prompts you to select a debugger.

    After the browser invokes a debugger, the browser displays the HTML page, which includes the client-side code but not the server-side code. The browser stops in break mode on the stop or the debugger statement.
  3. To set additional breakpoints in the code, click in the gray margin to the left of any line of code.
  4. To set breakpoints that stop only under certain conditions (conditional breakpoints), right-click on the breakpoint entry in the BreakPoints window in Visual Studio .NET, and then click Properties.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. In Visual Studio .NET, create a new ASP.NET project. WebForm1.aspx is created by default.
  2. When you open WebForm1.aspx in Visual Studio .NET, two tabs (Design and HTML) appear at the bottom of the page. Switch to HTML view.
  3. Add the following code to the Body section:
    <script language="vbscript">
        sub btn_onclick
        btn.value = btn.value + 1
        end sub
    </script>
    <INPUT type="button" value="0" id="btn">
  4. Set breakpoints in the client-side code. The btn_onclick procedure is client-side code. To set a breakpoint in this procedure, click in the gray margin to the left of the following code:
    btn.value = btn.value + 1
    After you set the breakpoint, a red dot appears in the gray margin next to that line of code.
  5. In the Solution Explorer window, right-click WebForm1, and then click Set As Start Page.
  6. Save your project.
  7. On the Build menu, click Build Project.
  8. On the Debug menu, click Start (or press the F5 key) to start a debug session.
  9. After the page appears in your browser, click the button. Notice that the client-side code runs, but the debugger does not stop at your breakpoint.

Modification Type:MajorLast Reviewed:8/29/2005
Keywords:kbvs2002sp1sweep kbBug kbDebug kbide kbpending kbScript KB317094 kbAudDeveloper