次の方法で共有


Debugger.LastBreakReason プロパティ

最後にプログラムが中断されたときの原因を取得します。 プログラムが実行中の場合は、DBG_REASON_NONE を返します。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)

構文

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

プロパティ値

型: EnvDTE.dbgEventReason
dbgEventReason 値。

解説

LastBreakReason は、プログラムが中断した原因を示す dbgEventReason 値を返します。 プログラムは、次のいずれかの原因で中断することがあります。

何もデバッグされていないか、またはデバッガーが実行モードの場合、このプロパティは dbgEventReasonNone を返します。

LastBreakReason プロパティの使用方法を次の例に示します。

このプロパティをテストするには

  1. ターゲット アプリケーションにブレークポイントを設定します。 アドインを実行します。

  2. ターゲット アプリケーションをデバッグ モードで実行します。

  3. アドインを実行します。

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

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

Debugger インターフェイス

EnvDTE 名前空間