Why doesn’t Visual Studio break on exceptions when debugging unit tests?

The reason why is that your exceptions are not unhandled. The unit testing framework is handling the exceptions under the hood and converting them to failures.

What you need to do instead is to break on thrown exceptions. If you combine this with enabling “Just My Code” (on by default) you should get the behavior you are expecting. Visual Studio will only break when exceptions thrown by your code occur.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)