views:

42

answers:

2

Hello,

If I use a try/catch and display a messagebox,I can only see the exception but the VS IDE does not point me to the Exact LINE...(although I get the name of the function and stacktrace)

Is there anyway to throw the exception back on the exact line during debugging without removing the try / catch blocks?

Thanks

A: 

Turn on first-chance exceptions in the debugger exceptions window. This will hook the selected exceptions at the point they are thrown, regardless of whether they are caught or not.

I should warn you that this can be quite tedious if your application triggers a lot of caught exceptions (which reflects a bad design, anyway).

Marcelo Cantos
+6  A: 

In Visual Studio, got to the Debug Menu -> Exceptions...

Make sure 'Thrown' is checked as well as 'User-Unhandled'.

That will make Visual Studio break on the line that threw the Exception even if it is handled (thus pointing you to the exact line).

Justin Niessner