Share via


Proprietà Debugger.LastBreakReason

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

Spazio dei nomi:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.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

LastBreakReason restituisce un oggetto dbgEventReason valore che indica il motivo per cui un programma si è interrotto.Un programma può essere suddiviso per uno dei seguenti motivi:

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

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(DTE dte)
{
    // Setup the 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: ");
    switch(dte.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;
    }
}
Shared Sub LastBreakReason(ByRef dte As EnvDTE.DTE)
    Select Case dte.Debugger.LastBreakReason
        Case dbgEventReason.dbgEventReasonBreakpoint
            MessageBox.Show("Breakpoint hit.", "Debugger Test - LastBreakReason")
        Case dbgEventReason.dbgEventReasonNone
            MessageBox.Show("No reason", "Debugger Test - LastBreakReason")
        Case dbgEventReason.dbgEventReasonExceptionNotHandled
            MessageBox.Show("Exception not handled by the debuggee", _
                            "Debugger Test - LastBreakReason")
        Case dbgEventReason.dbgEventReasonExceptionThrown
            MessageBox.Show("Exception thrown", "Debugger Test - LastBreakReason")
    End Select
End Sub

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Debugger Interfaccia

Spazio dei nomi EnvDTE