3

I have a .NET console app for which I do not have source code. When I run it, no output is produced on the console.

It's possible in VS to attach to a running process, but I can't find out how to launch a new process with the debugger attached.

3 Answers 3

9

File | Open | Project/Solution and then open the desired exe file.

Not sure which debugging features are available that way. But you can run it from VS that way.

But I'd look at it in reflector and try find the bug by just looking. Reflector pro visual studio addin might even show the decompiled source while debugging, but as I don't own it, I'm not sure if that works.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for this. I was able to create a breakpoint for my Main method Debug > New Breakpoint > Break and Function... and then launch via F5 as usual. A very nice trick. I'd never noticed the .exe filetype option in the New Project dialog before!
Also I had used ILSpy (the free, open source version of Reflector) to try and determine the bug, but it could have been one of many things due to the complexity of the method and a try with empty catch block around the whole thing :)
2

Yes, you just need to create a new project (ideally the same project otherwise just a dummy one) and on the project properties select "Start external program" and select your exe.

Comments

1

You can go about this a backwards way: Create a new solution and project. Pick a C# Console Application project. It doesn't really matter how this project is setup. Then, bring up the properties of the project, select the Debug section. Configure this section to run your progoram. For instance, change the Start Action to Start external program, setup your command line arguments, etc. Then when you run the project, it will run your program.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.