Share via


Attaching to Running Processes 

This topic applies to:

Visual Studio Edition

Visual Basic

C#

C++

J#

Visual Web Developer

Express

No

No

No

No

No

Standard

Yes

Yes

Yes

Yes

Yes

Pro/Team

Yes

Yes

Yes

Yes

Yes

The Visual Studio debugger has the ability to attach to a process that is running outside of Visual Studio. You can use this attach capability to do the following:

  • Debug an application that was not created in Visual Studio.

  • Debug multiple processes simultaneously. You can also debug multiple processes by starting multiple projects within a single solution.

  • Debug a process running on a remote machine.

  • Debug a DLL that runs in a separate process that cannot easily be started from Visual Studio, for example, a service or an ISAPI DLL running with Internet Information Services.

  • Start the debugger automatically when a process crashes while running outside of Visual Studio. This is Just-In-Time debugging.

Once you have attached to a program, you can use debugger execution commands, inspect the program state, and so on. For more information, see Execution Control and Viewing Data in the Debugger. Your ability to inspect the program may be limited, of course, depending on whether the program was built with debug information and whether you have access to the program's source code, and whether the common language runtime JIT compiler is tracking debug information.

NoteNote

For the debugger to attach to code written in C++, the code needs to emit DebuggableAttribute. You can add this to your code automatically by linking with the /ASSEMBLYDEBUG linker option.

In This Section

How to: Attach to a Running Process

How to: Set the Current Process

How to: Detach a Process

How to: Detach All Processes

How to: Select a Remote Machine

How to: Deal with Attach Errors

Debugger Roadmap