Microsoft KB Archive/811319

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

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  in the codebehind page of /folder1/WebForm1.aspx, the debugger may resolve this as line   in the codebehind page of /folder2/WebForm1.aspx. Line  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 &quot;Applies to&quot; section.



Steps to reproduce the behavior
 Start Visual Studio .NET. Create a new ASP.NET Web Application by using Visual C# .NET. Name the application BreakPointDemo . By default, the WebForm1.aspx file appears. In Solution Explorer, right-click the BreakPointDemo project, point to Add, and then click New Folder. Name the folder folder1 .</li> In Solution Explorer, right-click folder1, point to Add, and then click Add Web Form. Name the form WebForm1.aspx .</li> 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).</li>  Append the following code to the Page_Load event of WebForm1.aspx.cs in the root folder: Response.Write(&quot;Root Folder:WebForm1.aspx&quot;); </li>  Append the following code to the Page_Load event of WebForm1.aspx.cs in folder1: Response.Write(&quot;Folder1:WebForm1.aspx&quot;); </li>  Append the following code to the Page_Load event of WebForm1.aspx.cs in folder2: Response.Write(&quot;Folder2:WebForm1.aspx&quot;); demo; </li>  To create the demo function, paste the following code after the Page_Load event: private void demo {     // Test function Response.Write(&quot;folder2:demo&quot;); } </li>  Set the first breakpoint in the folder2\WebForm1.aspx.cs file in the Page_Load event on the following line: Response.Write(&quot;folder2:WebForm1.aspx&quot;); </li>  Set the second breakpoint in the folder2\WebForm.aspx.cs file in the demo function on the following line: Response.Write(&quot;folder2:demo&quot;); </li> In Solution Explorer, right-click folder2\WebForm1.aspx, and then click Set As Start Page.</li> Press F5, and then start debugging. To view the Breakpoints window in Visual Studio .NET Editor, press CTRL+ALT+B.</li> 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.</li> Rename the files by using a different name for each file, and then repeat step 15.</li></ol>

<div class="references_section">