Demonstra Passo a passo: Depuração em tempo de Design

This topic applies to:

Edition

Visual Basic

C#

F#

C++

Web Developer

Express

O tópico é aplicável O tópico é aplicável O tópico não é aplicável O tópico não é aplicável O tópico não é aplicável

Pro, Premium e Ultimate

O tópico é aplicável O tópico é aplicável O tópico é aplicável O tópico é aplicável O tópico é aplicável

You can use the Visual Studio Immediate window to execute a function or subroutine while your application is not running. If the function or subroutine contains a breakpoint, Visual Studio will break execution at the appropriate point. You can then use the debugger windows to examine your program state. This feature is called debugging at design time.

The following procedure shows how you can use this feature.

To hit breakpoints from the Immediate window

  1. Paste the following code into a Visual Basic console application:

    Module Module1
    
        Sub Main()
            MySub()
        End Sub
    
        Function MyFunction() As Decimal
            Static i As Integer
            i = i + 1
            Dim s As String
    
            s = "Add Breakpoint here"
            Return 4
        End Function
    
        Sub MySub()
            MyFunction()
        End Sub
    End Module
    
  2. Definir um ponto de interrupção na linha que lê, s="Add BreakPoint Here".

  3. Digite o seguinte na imediata janela: ?MyFunction <enter>

  4. Verify that the breakpoint was hit, and that the call stack is accurate.

  5. On the Debug menu, click Continue, and verify that you are still in design mode.

  6. Digite o seguinte na imediata janela: ?MyFunction <enter>

  7. Digite o seguinte na imediata janela: ?MySub <enter>

  8. Verifique se o ponto de interrupção e examine o valor da variável estática i na Locals janela. It should have the value of 3.

  9. Verify that the call stack is accurate.

  10. On the Debug menu, click Continue, and verify that you are still in design mode.

Consulte também

Conceitos

Segurança do Depurador

Outros recursos

Guia para o depurador