Debugger3.CurrentProcess Property

Gets or sets the active process.

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


Property CurrentProcess As Process
Process CurrentProcess { get; set; }
property Process^ CurrentProcess {
    Process^ get ();
    void set (Process^ value);
abstract CurrentProcess : Process with get, set
function get CurrentProcess () : Process
function set CurrentProcess (value : Process)

Property Value

Type: EnvDTE.Process
A Process object.




The active process is the process that defines the data displayed by the debugger. Although the debugger supports debugging more than one process at a time, only one process can be active at any given time. For more information, see Debugging Multiple Processes.


The following example shows how to use the CurrentProcess property.

To test this property:

  1. Open the target application. Run the add-in.

    No process is being debugged.

  2. Set a breakpoint in the target application. Run the application in the debug mode.

  3. When the program stops at the breakpoint, run the add-in.

    The process is being debugged.

public static void CurrentProcess(EnvDTE80.DTE2 dte)
    // Setup debug Output window.
    Window w =  
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Current Process 

    owp.OutputString("Current Process Info: ");
    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;
    EnvDTE90.Process2 process = (EnvDTE90.Process2)debugger.CurrentProcess;

    if (process == null)
        owp.OutputString("No process is being debugged");
        owp.OutputString("Process ID = " + process.ProcessID +
                         "  Process Name = " + process.Name);
Sub ShowCurrentProcess()
    ' This function displays the current debugger
    ' mode in the output window.
    Dim ow As OutputWindow
    ow = dte.Windows.Item(Constants.vsWindowKindOutput).Object

    Dim proc As EnvDTE90.Process3
    proc = dte.Debugger.CurrentProcess

    If (proc Is Nothing) Then
        ow.ActivePane.OutputString("No process is being debugged")
        ow.ActivePane.OutputString("" + Str(proc.ProcessID) + ": " + _
        poc.Name + vbCrLf)
    End If
End Sub

.NET Framework Security

See Also


Debugger3 Interface

CurrentProcess Overload

EnvDTE90 Namespace