Microsoft KB Archive/811319

From BetaArchive Wiki

Article ID: 811319

Article Last Modified on 8/26/2005



APPLIES TO

  • Microsoft ASP.NET 1.0
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Academic Edition




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.

CAUSE

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

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.


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 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.


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


Keywords: kbbug kbwebforms kbdebug kbvs2002sp1sweep KB811319