"Unable to set the next statement to this location" error message when you are debugging a Visual Studio 2005 application (919808)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Express Edition
  • Microsoft Visual Basic 2005
  • Microsoft Visual C# 2005, Express Edition
  • Microsoft Visual Studio 2005 Team System Architect Edition
  • Microsoft Visual Studio 2005 Team System Developer Edition
  • Microsoft Visual Studio 2005 Team System Team Foundation:
  • Microsoft Visual Studio 2005 Team System Test Edition

SYMPTOMS

When you are debugging a Microsoft Visual Studio 2005 application and you try to set the next statement, you may receive an error message that resembles the following error message:
Unable to set the next statement to this location. There is no executable code at this location in the source code.

CAUSE

The Debugger Engine is picking the statements in sequence. As long as the caret is at the end of the line, the Debugger Engine will set the next statement on the next line. If there is no executable code from the next line, an error message will occur.

STATUS

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

MORE INFORMATION

Steps to reproduce the behavior

Visual Basic 2005
  1. Start Visual Studio 2005.
  2. Click the File menu, click New, and then click Project.
  3. Expand Visual Basic, click Console Application, type ConsoleApplication1 in the Name text box, and then click OK.
  4. Replace the code in the Module1.vb file with the following code.
    Module Module1
    
        Sub Main()
            Dim x As Integer
            x = 1
        End Sub
    
    
    End Module
    
  5. Set a Breakpoint on the x = 1 line.
  6. Click the Debug menu, and then click Start Debugging.
  7. Position the cursor to the right of the b in End Sub, right-click with the caret in the same position as the cursor, and then click Set Next Statement.
You then see the error message that is mentioned in the symptoms section.

Visual C# 2005
  1. Start Visual Studio 2005.
  2. Click the File menu, click New, and then click Project.
  3. Expand Visual C#, click Console Application, type ConsoleApplication1 in the Name text box, and then click OK.
  4. Replace the code in the Program.cs file with the following code.
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
                int x;
                x = 1;
            }
        }
    }
    
  5. Set a Breakpoint on the x = 1; line.
  6. Click the Debug menu, and then click Start Debugging.
  7. Position the cursor to the right of the closing curly brace for the static void Main method, right-click with the caret in the same position as the cursor, and then click Set Next Statement.
You then see the error message that is mentioned in the symptoms section.

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbtshoot kberrmsg kbinfo kbprb KB919808 kbAudDeveloper