Share via


Debugger3.DebuggedProcesses Property

Gets the list of processes that are being debugged.

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

Syntax

'Declaration
ReadOnly Property DebuggedProcesses As Processes
Processes DebuggedProcesses { get; }
property Processes^ DebuggedProcesses {
    Processes^ get ();
}
abstract DebuggedProcesses : Processes with get
function get DebuggedProcesses () : Processes

Property Value

Type: EnvDTE.Processes
A Processes collection.

Remarks

DebuggedProcesses gets a Processes collection representing the processes that are currently being debugged.

Examples

The following example shows how to use the DebuggedProcesses property.

To test this property:

  1. Set a breakpoint in the target application. Run the add-in.

    No processes are being debugged.

  2. Set a breakpoint in the target application. Run the target. When the application stops at the breakpoint, run the add-in.

    The process is being debugged.

public static void DebuggedProcesses(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("Debugged Processes 
    Test");
    owp.Activate();

    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;
    EnvDTE.Processes processes = debugger.DebuggedProcesses;
    if (processes.Count == 0)
        owp.OutputString("No processes are being debugged.");
    else
        foreach (EnvDTE.Process proc in processes)
            owp.OutputString("\nProcess: [" + proc.ProcessID + "] " + 
                             proc.Name);
}
Sub ListDebuggedProcesses()
    Dim ow As OutputWindow
    ow = DTE2.Windows.Item(Constants.vsWindowKindOutput).Object
    Dim proc As EnvDTE.Process2

    If DTE2.Debugger.DebuggedProcesses.Count = 0 Then
        ow.ActivePane.OutputString("No processes are being debugged." _
        & vbCrLf)

    Else
        For Each proc In DTE2.Debugger.DebuggedProcesses
            ow.ActivePane.OutputString("Process: [" + _
            Str(proc.ProcessID) + "] " + proc.Name + vbCrLf)
        Next
   End If
End Sub

.NET Framework Security

See Also

Reference

Debugger3 Interface

EnvDTE90 Namespace