How to attach an exe to the debugger?

R

rdufour

In Vs2005, I need to be able to single step through the application events
unhandledexception event. Just putting a breakpoint on a line of code in
there does not work because running the app in debug mode the unhandled
exception I throw for testing gets intercepted by the VS2005 IDE. Someone
suggested running the exe and attaching it to the debugger, but I can't seem
to find out how to do that.

Can anyone tell me how its possible to debug code in the application events
unhandledexception event. Exactly what are the steps needed to be able to do
that. I can't find any info on this in the docs.
Has anyone managed to do this before?

Any help would be greatly appreciated.
Bob
 
H

Herfried K. Wagner [MVP]

rdufour said:
In Vs2005, I need to be able to single step through the application events
unhandledexception event. Just putting a breakpoint on a line of code in
there does not work because running the app in debug mode the unhandled
exception I throw for testing gets intercepted by the VS2005 IDE.

Check out "Debug" -> "Exceptions...". You can configure how the IDE should
behave if an exception occurs there.
 
R

Robert Dufour

Herfried could you please be more specific, I looked at that but I really
can't figure what setting to change.
I tried unchecking enable exception assistant, but then my app just quits on
unhandled exception which is not what I need. I also tried unchecking the
common language runtime exceptions, the app just terminates, there just
seems to be no way to get to a breakpoint in the unhandledexception event in
the applicationevents in Vs2005.
If anyone managed to do this I would really appreciate knowing how.

Bob
 
C

Chris Dunaway

rdufour said:
exception I throw for testing gets intercepted by the VS2005 IDE. Someone
suggested running the exe and attaching it to the debugger, but I can't seem
to find out how to do that.

Run your .EXE. In VS, choose Tools->Attach To Process. Select your
..exe from the list. Your breakpoints should now be hit.

If your exception occurs before you can attach the debugger, you might
have to put a Thread.Sleep or some other pause at the very beginning of
the code so that you have time to attach the debugger.
 
R

Robert Dufour

Thanks,
Bob
Chris Dunaway said:
Run your .EXE. In VS, choose Tools->Attach To Process. Select your
.exe from the list. Your breakpoints should now be hit.

If your exception occurs before you can attach the debugger, you might
have to put a Thread.Sleep or some other pause at the very beginning of
the code so that you have time to attach the debugger.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top