Demonstra Passo a passo: Depuração em tempo de Design
This topic applies to:
Edition |
Visual Basic |
C# |
F# |
C++ |
Web Developer |
---|---|---|---|---|---|
Express |
|||||
Pro, Premium e Ultimate |
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
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
Definir um ponto de interrupção na linha que lê, s="Add BreakPoint Here".
Digite o seguinte na imediata janela: ?MyFunction <enter>
Verify that the breakpoint was hit, and that the call stack is accurate.
On the Debug menu, click Continue, and verify that you are still in design mode.
Digite o seguinte na imediata janela: ?MyFunction <enter>
Digite o seguinte na imediata janela: ?MySub <enter>
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.
Verify that the call stack is accurate.
On the Debug menu, click Continue, and verify that you are still in design mode.