简体   繁体   中英

Cannot debug unit tests in Visual Studio 2010 SP1

This question is very similar to this one , but I'm experiencing it in Visual Studio 2010 SP1. I am running my tests locally (there is no remote test controller).

I recently started working on a client's .NET 4.0 project. It has a suite of Visual Studio Unit Testing Framework unit tests. When I launch the unit tests, IIS Express automatically starts. I can run the unit tests dozens of times without any issues to see whether they pass or fail. However, when I attempt to debug the unit tests (by right-clicking on a test in Test View and clicking Debug Selection ), it almost always fails with the following error message:

Error 3/19/2014 2:42:44 PM Failed to queue test run 'ThoughtProcess@HOSTNAME 2014-03-19-14:42:40': Process with an Id of [12345] is not running.

I say "almost" because every 20 or so clean starts of VS, it will successfully attach the debugger. But I haven't been able to consistently reproduce this behavior.

I tried the suggestions from the Visual Studio 2012 post, but those didn't work in my situation. Has anyone else encountered this issue?

In the spirit of this xkcd comic , I did find a solution to this issue by installing ReSharper and using its test runner instead of the built-in Visual Studio test runner.

The ReSharper runner consistently and repeatably lets me run and debug unit tests without any issues. I'm still not sure that I understand the underlying cause of why the VS runner can't debug, but hopefully this will save someone else future frustration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM