Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I attach a process to the debugger in Visual Studio?

Tags:

I know I can start a process in code with Process.Start(). Is it also possible to attach the debugger to that process?

Not from code per se , but just a way to do it?

like image 389
Bertvan Avatar asked Jun 12 '09 12:06

Bertvan


People also ask

What does attaching to debugger mean?

However, there are some situations where you must debug the application in a different way — by attaching to its process. Attaching to the process means telling the CPU to send the instructions in the executable code to a debugger before they're executed by the CPU.

How do you debug DLL attach to process?

Debug from the DLL project Set breakpoints in the DLL project. Right-click the DLL project and choose Set as Startup Project. Make sure the Solutions Configuration field is set to Debug. Press F5, click the green Start arrow, or select Debug > Start Debugging.

Why does Visual Studio says attach instead of start?

You need to create a new Python related project(or open a Python project) in Visual Studio to debug your project which includes the . py file and python codes. Just open a single . py file is not enough to debug the project in Visual Studio, so you will see the “Start” changed to “Attach…”.


1 Answers

You can attach to a running process using Tools | Attach to Process. If it's a Web Application, you can attach to it by attaching to aspnet_wp.exe or w3wp.exe.

To answer your question on how to attach to a process programmatically:

  • Attaching to a Process Using VS.NET Automation Model

Here are other Stack Overflow questions that deal with that:

  • Communicating with the Visual Studio Debugger Programmatically?
  • Programmatically apply breakpoints in Visual Studio
like image 90
George Stocker Avatar answered Oct 04 '22 12:10

George Stocker