Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets the last reason that a program was broken. If the program is running it returns DBG_REASON_NONE.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
ReadOnly Property LastBreakReason As dbgEventReason
dbgEventReason LastBreakReason { get; }
property dbgEventReason LastBreakReason {
dbgEventReason get ();
}
abstract LastBreakReason : dbgEventReason
function get LastBreakReason () : dbgEventReason
Property Value
Type: EnvDTE.dbgEventReason
A dbgEventReason value.
Remarks
LastBreakReason returns a dbgEventReason value indicating why a program broke. A program can be broken for one of the following reasons:
A breakpoint was hit.
Returns a dbgEventReasonBreakpoint.
An exception was thrown.
Returns a dbgEventReasonExceptionThrown.
An exception was thrown but not handled by the program being debugged.
Returns a dbgEventReasonExceptionNotHandled.
If nothing is being debugged or the debugger is in run mode, this property returns dbgEventReasonNone.
Examples
The following example demonstrates how to use the LastBreakReason property.
To test this property:
Set a breakpoint in the target application. Run the add-in.
Run the target application in the debug mode.
Run the add-in.
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 Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.