Jay Sullivan
Jay Sullivan

Reputation: 18299

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't 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?

Upvotes: 1

Views: 1550

Answers (2)

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93494

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.

Upvotes: 3

Alexei Levenkov
Alexei Levenkov

Reputation: 100630

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.

Upvotes: 1

Related Questions