Process.Attach Method
Causes the debugger to attach this process.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
Sub Attach
'Usage
Dim instance As Process
instance.Attach()
void Attach()
void Attach()
function Attach()
Examples
The following example demonstrates how to use the Attach method.
To test this method:
Run the target application in the nondebug mode. Make sure that the application contains an infinite loop.
Run the add-in.
Set the breakpoint inside the infinite loop.
public static void Attach(DTE dte)
{
EnvDTE.Processes processes = dte.Debugger.LocalProcesses;
foreach(EnvDTE.Process proc in processes)
if(proc.Name.IndexOf("Target.exe") != -1)
proc.Attach();
}
Shared Sub Attach(ByRef dte As EnvDTE.DTE)
Dim processes As EnvDTE.Processes = dte.Debugger.LocalProcesses
For Each proc As EnvDTE.Process In processes
If proc.Name.IndexOf("Target.exe") <> -1 Then
proc.Attach()
End If
Next
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.