Solved

Debug console application while Process class to execute console

Posted on 2009-06-29
4
592 Views
Last Modified: 2013-11-26
Hi there,

I have a simple console application which is running fine. I have placed some breakpoints within the console application and these breakpoints are hit when I execute the console application through visual studio by marking the console project as startup project.  Till this point everthing is fine.

But when I tried to execute the console project using WindowsForm which is using Process() to execute the console project. The console project is running fine with process.Start(), but the problem is that the breakpoints within the console application are NOT hit when I execute the console application through Process() class. I will be thankful for your help.
0
Comment
Question by:tech1guy
  • 2
  • 2
4 Comments
 
LVL 33

Expert Comment

by:Todd Gerbert
Comment Utility
You need to attach the debugger to an external process.  After your console application's Procress.Start() is called, go to Tools menu in Visual Studio, then choose Attach to Process.

If you need time to attach the debugger, you may want to introduce dialog box in your console application to cause it to "pause" until you click OK (during which time you can get the debugger attached)!
0
 

Author Comment

by:tech1guy
Comment Utility
which process I need to attach? When I try to attach the TestForm.exe (where I am calling console app through Process), it says that it is already attached. I am executing through F5.
Moreover, is there a way to programaticaaly attach the debugger to Procees?
0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 500 total points
Comment Utility
Process.Start() has the same basic effect as double-clicking an icon on your desktop, Visual Studio won't automatically debug it because of the way you're starting it.

1) You'll probably need to start a new instance of Visual Studio to debug the console application.
2) Attach to the console process that's being Process.Start()'ed.
3) Don't think so.
0
 

Author Closing Comment

by:tech1guy
Comment Utility
Thanks for the information.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now