0

I am debugging an application someone else wrote which runs as a Windows Service unless it is started from the Console and passed parameters. I would like to start this program from the Console, including some parameters, and then step into the debugger. I'm not sure how to do this since before I execute the command to start it, there is no process to attach to, and once I execute the command, it's too late to catch it (errors begin almost instantly). I'm trying to figure out if there's a way in Visual Studio to set up the debugger to attach to a process before it's actually running (or perhaps something effectively similar, given the description of my problem).

I have a breakpoint on the very first line of Program.Main and I'm essentially trying to figure out how I can launch the application from the Command Prompt and then immediately hit my breakpoint. Is this even possible?

I'm running VS 2013 on Windows Server 2012 Datacenter, by the way.

bubbleking
  • 3,329
  • 3
  • 29
  • 49

1 Answers1

1

I think that you don't need to run this program from console - just run (start debugging) it with parameters. Here there is similar question, it should solve you problem. Note that if for some reason my advice is not a good solution for you, you can use solution from second answer (from link) - it's exactly what you are asking for.

Community
  • 1
  • 1
cyriel
  • 3,522
  • 17
  • 34