Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Debugger does not stop at the set breakpoints in a .NET-connected Web application when more than one file has the same file name


View products that this article applies to.

Symptoms

When you try to debug an ASP.NET Web Application that contains many ASPX (Web Form) files, and these files have the same name but are located in different folders, such as:
  • /folder1/WebForm1.aspx
  • /folder2/WebForm1.aspx
the debugger does not stop at the breakpoints that you set. Also, the debugger may stop at other breakpoints that you did not set. For example, when you set a breakpoint on line x in the codebehind page of /folder1/WebForm1.aspx, the debugger may resolve this as line x in the codebehind page of /folder2/WebForm1.aspx. Line x may or may not exist in this file.

↑ Back to the top


Cause

The debugger may not correctly resolve the breakpoint on the corresponding file because another file that has the same name exists.

↑ Back to the top


Resolution

To work around this problem, use one of the following options:
  • Use unique file names for all files in your ASP.NET Web Application.

    -or-
  • Temporarily change the file names in the Development or Debugging phase. Revert to the old names when you are ready to deploy the project.

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to reproduce the behavior

  1. Start Visual Studio .NET.
  2. Create a new ASP.NET Web Application by using Visual C# .NET. Name the application BreakPointDemo.
  3. By default, the WebForm1.aspx file appears.
  4. In Solution Explorer, right-click the BreakPointDemo project, point to Add, and then click New Folder.
  5. Name the folder folder1.
  6. In Solution Explorer, right-click folder1, point to Add, and then click Add Web Form. Name the form WebForm1.aspx.
  7. Repeat steps 4 through 6 to add folder2, and to add a different file named WebForm1.aspx in folder2.

    Note Verify that the names of the two Web Forms (.aspx files) in folder1 and folder2 are the same (WebForm1.aspx).
  8. Append the following code to the Page_Load event of WebForm1.aspx.cs in the root folder:
    Response.Write("Root Folder:WebForm1.aspx");
  9. Append the following code to the Page_Load event of WebForm1.aspx.cs in folder1:
    Response.Write("Folder1:WebForm1.aspx");
  10. Append the following code to the Page_Load event of WebForm1.aspx.cs in folder2:
    Response.Write("Folder2:WebForm1.aspx");
    demo();
  11. To create the demo function, paste the following code after the Page_Load event:
    private void demo()
    	{
    	  // Test function
    	  Response.Write("folder2:demo");
    	}
  12. Set the first breakpoint in the folder2\WebForm1.aspx.cs file in the Page_Load event on the following line:
    Response.Write("folder2:WebForm1.aspx");
  13. Set the second breakpoint in the folder2\WebForm.aspx.cs file in the demo function on the following line:
    Response.Write("folder2:demo"); 
  14. In Solution Explorer, right-click folder2\WebForm1.aspx, and then click Set As Start Page.
  15. Press F5, and then start debugging. To view the Breakpoints window in Visual Studio .NET Editor, press CTRL+ALT+B.
  16. In the Breakpoints window, note that the breakpoint that you put in the demo function may move to Page: folder1\WebForm1.aspx.cs. You may also see other breakpoints that you did not set in folder1\WebForm1.aspx.cs.

    Note Expand the #region section in the folder1\WebForm1.aspx.cs file to see the breakpoint that is set by the debugger.
  17. Rename the files by using a different name for each file, and then repeat step 15.

↑ Back to the top


References

For more information about .NET Debugger, click the following article numbers to view the articles in the Microsoft Knowledge Base:
306169� PRB: Visual Studio .NET debugger does not stop on breakpoints when you debug
316726� How to debug an ASP.NET web application
306172� INFO: Common errors when you debug ASP.NET applications in Visual Studio .NET

↑ Back to the top


Keywords: kbvs2002sp1sweep, kbdebug, kbwebforms, kbbug, KB811319

↑ Back to the top

Article Info
Article ID : 811319
Revision : 7
Created on : 8/26/2005
Published on : 8/26/2005
Exists online : False
Views : 420