Daily Usage Issues

VS2013 Hangs after debugging test fininshed

Started by JohanSpannare on 7,894 views

VS2013 Hangs waiting on the TestHost451.x86.exe to terminate.

The process cant be terminated manually via Taskmanager either.

http://imgur.com/cfPsJXV

The only way to terminate it, is to close VS2013.


This start to occure after we switched on "Terminate test runner tasks.....". We did that because we have problem that if you stop debugging a test that has an active transaction. The transaction is not rolledback.

Best reg
Johan Spännare

Edited

Hi Johan,

I suspect this problem is likely to be related to the code being executed by the test host (i.e. your test code or code under test).

When NCrunch terminates a task runner process, it does so using a hard kill - the same as what you would do if trying to kill the process using task manager. If task manager cannot stop/kill the process, neither can NCrunch.

I recommend taking a look at the activities of this process at the time your test execution run completes. Check particularly for background threads in your code that may be calling into lower level APIs or O/S resources. Ensure that when your tests complete their execution, any state that might hang the process or interfere with its termination has been properly released.
I tried to attach to the process, but that didn't work. So i inspected the process via Process Explorer. And found this threads. No thread are running any application code what I can see. https://imgur.com/zzUUwb4

I got an assert exception i a test when it happen.

I submitted an bug report on this issue.

Johan

Edited

Hi Johan,

Does this only happen when you attach a debugger to the process?

Does it happen consistently?

Do you see it happen on other solutions (i.e. a sample test project with a single empty test)?
Hi Remco!

It seams to me that it only occurs when we are debugging. Sadly it happen randomly, but often after been working for a half day without restarting VS. As I said before I have an dump file if you are interested.

I have not experienced it out side our two main solution files.

We currently have over 12K tests in 5 assemblies that ncrunch is monitoring.

Best reg
Johan
Hi Johan,

The VS debugger unfortunately has a history of problems like this ...

MS regularly roll out fixes, but as the problems are often intermittent and environment specific, it's understandably hard to pin them down and resolve them all. The debugger is also subject to other constraints introduced at a low level. It wouldn't be surprised if your SQL transactions were somehow related to this.

NCrunch's integration with the debugger is actually minimal. When requested to run a test with a debugger, NCrunch will launch the test process, then make a call to the IDE to tell it to attach to the process before any test execution begins. When the test execution is complete, NCrunch calls EnvDTE.Process.Detach().

Unfortunately there's very little I can do to help with problems in the debugger itself. Although NCrunch may be surfacing the issue on your system, the workings of the debugger is outside the boundary of what I'm able to troubleshoot.

It may be worth trying a reset of your VS settings to see if this solves the issue - https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3cc5813e-363b-4ab0-85db-5c35ad092aa0/visual-studio-hangs-up-after-stop-debug.
I will try resetting VS settings and see if it resolves the problem.

Best reg
Johan Spännare

Post a reply

Log in to reply.