Breakpoints may resolve to another project in the solution in Visual Studio 2005 or in Visual Studio .NET (891403)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 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
  • 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

SYMPTOMS

When you set a breakpoint in a project that is part of a Microsoft Visual Studio 2005 or Microsoft Visual Studio .NET solution, the breakpoint may resolve to another project in the solution.

CAUSE

This issue may occur if the following conditions are true:
  • The projects have the same file name.
  • Each project contains a class that has the same name.
This issue is a limitation of the scoping algorithm that is used to resolve breakpoints.

WORKAROUND

To work around this issue, use one of the following methods:
  • Rename one of the files that is used in the Visual Studio 2005 or Visual Studio .NET solution.
  • Create separate projects. Do not include the projects in a Visual Studio 2005 or Visual Studio .NET solution.

MORE INFORMATION

Steps to reproduce the issue

  1. Start Microsoft Visual Studio 2005 or Microsoft Visual Studio .NET.
  2. Create a new Microsoft Visual C# console application, and then name it Hello1.
  3. Paste the following code in the Class1.cs file.
    using System;
    
    namespace App1
    {
    	
    	class Hello
    	{
    		
    		
    		[STAThread]
    		static void Main(string[] args)
    		{
    			Console.WriteLine( "Hello World, App1" );
    			
    		}
    	}
    }
    Note In Visual Studio 2005, paste this code in the Program.cs file.
  4. Click File, point to New, and then click Project.
  5. Create a new Visual C# console application, and then name it Hello2.
  6. Paste the following code in the Class1.cs file.
    using System;
    
    namespace App2
    {
    	
    	class Hello
    	{
    		
    		
    		[STAThread]
    		static void Main(string[] args)
    		{
    			Console.WriteLine( "Hello World, App2" );
    			
    		}
    	}
    }
  7. Add the projects to a Visual Studio 2005 or Visual Studio .NET solution.
  8. Set a breakpoint in one of the projects, and then click Start on the Debug menu.

Modification Type:MajorLast Reviewed:2/24/2006
Keywords:kbvs2005swept kbvs2005applies kbProgramming kbtshoot kbprb KB891403 kbAudDeveloper