Compartir a través de


Debugger3.LastBreakReason (Propiedad)

Obtiene el último motivo por el que se interrumpió un programa. Si el programa está en ejecución, devuelve DBG_REASON_NONE.

Espacio de nombres:  EnvDTE90
Ensamblado:  EnvDTE90 (en EnvDTE90.dll)

Sintaxis

'Declaración
ReadOnly Property LastBreakReason As dbgEventReason
dbgEventReason LastBreakReason { get; }
property dbgEventReason LastBreakReason {
    dbgEventReason get ();
}
abstract LastBreakReason : dbgEventReason with get
function get LastBreakReason () : dbgEventReason

Valor de propiedad

Tipo: dbgEventReason
Valor dbgEventReason.

Comentarios

Por ejemplo, un programa se puede interrumpir por alguno de los motivos siguientes:

Si no se está depurando nada o si el depurador está en modo de ejecución, esta propiedad devuelve dbgEventReasonNone.

Para obtener una lista completa de enumeraciones, vea dbgEventReason.

Ejemplos

En el siguiente ejemplo se muestra cómo usar la propiedad LastBreakReason.

Para probar esta propiedad:

  1. Establezca un punto de interrupción en la aplicación de destino. Ejecute el complemento.

  2. Ejecute la aplicación de destino en el modo de depuración.

  3. Ejecute el complemento.

public static void LastBreakReason(EnvDTE80.DTE2 dte)
{
    // Setup debug Output window.
    Window w = 
    (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Last Break Reason 
    Test");
    owp.Activate();

    owp.OutputString("The reason that a program was broken: ");
    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;
    switch (debugger.LastBreakReason)
    {
        case dbgEventReason.dbgEventReasonBreakpoint:
            owp.OutputString("Breakpoint hit.");
            break;
        case dbgEventReason.dbgEventReasonNone:
            owp.OutputString("No reason");
            break;
        case dbgEventReason.dbgEventReasonExceptionNotHandled:
            owp.OutputString("Exception not handled by the debuggee");
            break;
        case dbgEventReason.dbgEventReasonExceptionThrown:
            owp.OutputString("Exception thrown");
            break;
    }
}
Sub LastBreakReason()
    ' This function shows the reason break mode was entered
    ' in the Output window.
    Dim ow As OutputWindow
    ow = DTE2.Windows.Item(Constants.vsWindowKindOutput).Object

    Select Case DTE2.Debugger.LastBreakReason
        Case dbgEventReason.dbgEventReasonBreakpoint
            ow.ActivePane.OutputString("Breakpoint hit" + vbCrLf)

        Case dbgEventReason.dbgEventReasonNone
            ow.ActivePane.OutputString("No reason" + vbCrLf)

        Case dbgEventReason.dbgEventReasonExceptionNotHandled
            ow.ActivePane.OutputString("Exception not handled by the _
            debuggee" + vbCrLf)

        Case dbgEventReason.dbgEventReasonExceptionThrown
            ow.ActivePane.OutputString("Exception thrown" + vbCrLf)
    End Select
End Sub

Seguridad de .NET Framework

Vea también

Referencia

Debugger3 Interfaz

EnvDTE90 (Espacio de nombres)