开发者

How to Debug better even after using try catch

开发者 https://www.devze.com 2023-01-08 16:56 出处:网络
If I use a try/catch and display a messagebox,I ca开发者_开发知识库n 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

If I use a try/catch and display a messagebox,I ca开发者_开发知识库n 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


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


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


In case you use VS 2017.

How to Debug better even after using try catch

Check either Common Language Runtime Exceptions or one you need from the list below.

How to Debug better even after using try catch

0

精彩评论

暂无评论...
验证码 换一张
取 消