Visual Studio 2010 test not entering debugger on exception
I'm trying to debug a C# app with Visual Studio 2010, using Microsoft.VisualStudio.TestTools.UnitTesting.
When I run a test in debug mode, and the test throws an exception, it doesn'开发者_如何学Ct pop me in to the debugger, it just exits and tells me an unhandled exception was thrown.
Is there a way I can get it to open the debugger the same way it does when an unhandled exception occurs while debugging an application?
Visual Studio allows you to define what kind of exceptions should be caught by the debugger. Go to Debug->Exceptions or ctlr-alt-e.
Then you can make sure the exception you want to catch is enabled.
Make sure you are doing "Test->Debug" or "Debug test"/"Debug selected test". Just running tests with configuration set to Debug will not attach debugger to the running test.
精彩评论