Process.Detach Method

Causes the debugger to detach from this process.

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

Syntax

'Declaration
Sub Detach ( _
    WaitForBreakOrEnd As Boolean _
)
void Detach(
    bool WaitForBreakOrEnd
)
void Detach(
    [InAttribute] bool WaitForBreakOrEnd
)
abstract Detach : 
        WaitForBreakOrEnd:bool -> unit
function Detach(
    WaitForBreakOrEnd : boolean
)

Parameters

  • WaitForBreakOrEnd
    Type: System.Boolean

    Set to true if the debugging session should stop only when it reaches a break or the end. Set to false if you intend to stop debugging, but you have to perform other tasks in the macro even before the debugger breaks or ends. For more information, see Breaking Execution.

Remarks

This method causes the debugger to detach from the current process.

Examples

The following example demonstrates how to use the Detach method.

To test this method

  1. Run the target application in the debug mode. Make sure that the application contains an infinite loop.

  2. Set the breakpoint inside the infinite loop.

  3. Run the add-in.

public static void Detach(DTE dte)
{
    EnvDTE.Processes processes = dte.Debugger.DebuggedProcesses;
    processes.Item(1).Detach(true);
}
Shared Sub Detach(ByRef dte As EnvDTE.DTE)
    Dim processes As EnvDTE.Processes = dte.Debugger.DebuggedProcesses
    processes.Item(1).Detach(True)
End Sub

.NET Framework Security

See Also

Reference

Process Interface

EnvDTE Namespace

Other Resources

<PAVE OVER> How to: Detach All Processes