?
Solved

Debug console application while Process class to execute console

Posted on 2009-06-29
4
Medium Priority
?
602 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

801 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