Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Debug better even after using try catch

Tags:

c#

exception

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

like image 488
Josh Avatar asked May 03 '26 17:05

Josh


1 Answers

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).

like image 105
Justin Niessner Avatar answered May 05 '26 06:05

Justin Niessner