Share via


Proprietà Debugger3.LastBreakReason

Ottiene l'ultima motivo per cui un programma è stato interrotto.Se il programma è in esecuzione restituisce DBG_REASON_NONE.

Spazio dei nomi:  EnvDTE90
Assembly:  EnvDTE90 (in EnvDTE90.dll)

Sintassi

'Dichiarazione
ReadOnly Property LastBreakReason As dbgEventReason
dbgEventReason LastBreakReason { get; }
property dbgEventReason LastBreakReason {
    dbgEventReason get ();
}
abstract LastBreakReason : dbgEventReason
function get LastBreakReason () : dbgEventReason

Valore proprietà

Tipo: EnvDTE.dbgEventReason
In dbgEventReason valore.

Note

Un programma può essere suddiviso, ad esempio, per alcuni dei motivi seguenti:

Se non si sta eseguendo il debug o il debugger è in modalità di esecuzione, questa proprietà restituisce dbgEventReasonNone.

Per un elenco completo delle enumerazioni, vedere dbgEventReason.

Esempi

Nell'esempio seguente viene illustrato come utilizzare LastBreakReason proprietà.

Per verificare questa proprietà:

  1. Impostare un punto di interruzione nell'applicazione di destinazione.eseguire il componente aggiuntivo.

  2. Eseguire l'applicazione di destinazione in modalità di debug.

  3. eseguire il componente aggiuntivo.

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Debugger3 Interfaccia

Overload LastBreakReason

Spazio dei nomi EnvDTE90