Share via


Debugger2.DetachAll Method

Detaches from all attached programs.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Sub DetachAll
void DetachAll()
void DetachAll()
abstract DetachAll : unit -> unit
function DetachAll()

Remarks

DetachAll attempts to detach from all attached programs. This operation can fail if attached process cannot be detached. See How to: Detach Programs for more information.

Examples

The following example demonstrates how to use the DetachAll method.

To test this method:

  1. Use the infinite loop in the target application code.

  2. Run the target application in the debug mode.

  3. Run the add-in.

    The debugger is detached from the target application.

public static void DetachAll(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("DetachAll Method 
    Test");
    owp.Activate();

    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)dte.Debugger;
    debugger.DetachAll();
    owp.OutputString("Detached all processes.");
}
Sub DetachAll()
    On Error Goto BadDetach
    DTE2.Debugger.DetachAll()
    Exit Sub

    BadDetach:
        MsgBox("Could not detach from all processes.")
End Sub

.NET Framework Security

See Also

Reference

Debugger2 Interface

EnvDTE80 Namespace