Limitations on Script Debugging

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Visual Studio supports the debugging of client-side script, subject to the limitations in this topic.

Limitations on Breakpoint Mapping with Client-Side Script

Visual Studio enables you to set a breakpoint in a server-side ASPX or HTML file that is transformed to a client-side file at run time. Visual Studio maps the breakpoint from the server-side file to a corresponding breakpoint in the client-side file, subject to the following limitations:

  • Breakpoints must be set inside <script> blocks. Breakpoints in inline script or <% %> blocks cannot be mapped.

  • The browser URL for the page must contain the page name. For example, https://microsoft.com/default.apsx. Breakpoint mapping cannot recognize a redirection from an address such as https://microsoft.com to the default page.

  • The breakpoint must be set in the page specified in the browser URL, not in an ASPX control (ascx) file, Master page, or other file included by that page. Breakpoints set in included pages cannot be mapped.

  • Breakpoints set in <script defer=true> blocks cannot be mapped.

  • For breakpoints set in <script id=""> blocks, breakpoint mapping ignores the id attribute.

Breakpoint Mapping and Duplicate Lines

To find the corresponding location in server-side and client-side script, the breakpoint mapping algorithm examines the code on each line. The algorithm assumes that each line is unique. If two or more lines contain the same code, and you set a breakpoint on one of those duplicate lines, the breakpoint mapping algorithm might select the wrong duplicate in the client-side file. To prevent this, add a comment to the line where you have set the breakpoint. For example:

i++ ;  
i ++; // I added a comment, so this line is now unique  
i ++;