The debugging session ends and returns to design mode in a Visual Basic .NET or Visual Basic 2005 project (319964)



The information in this article applies to:

  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)

This article was previously published under Q319964

SYMPTOMS

If you debug a Visual Basic .NET or Visual Basic 2005 project in break mode, the debugging session ends and the project returns to design mode.

CAUSE

This behavior occurs if you try to evaluate a variable or function in break mode after you receive a System.StackOverflowException exception.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
  2. Create a new Console Application project using Microsoft Visual Basic. By default, Module1 is created.
  3. Replace the contents of Module1 with the following code:
    Module Module1
        Public i As Integer = 10
    
        Sub Main()
            MyProc()
        End Sub
    
        Sub MyProc()
    
            'Recursively call the same procedure until
            'a StackOverFlowException is thrown
            MyProc()
        End Sub
    End Module
    					
  4. Save the project.
  5. On the Debug menu, click Start. Note that the code execution stops with the following exception:
    An unhandled exception of type 'System.StackOverflowException' occurred in <Application>.exe
  6. Click Break to enter break mode.
  7. On the Debug menu, point to Windows, and then click Immediate.
  8. Run the following statement from the immediate window to print the current value of the variable:
    ?i
    					
    Note that the project resets and is no longer in break mode.

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005swept kbvs2005applies kbvs2002sp1sweep kbBug kbDebug kbnofix kbprb KB319964 kbAudDeveloper