Solved

Debug console application while Process class to execute console

Posted on 2009-06-29
4
596 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
ID: 24739850
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
ID: 24739898
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
ID: 24739951
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
ID: 31598098
Thanks for the information.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 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