Vstest.executionengine.x86.exe does not close

I had an error while performing unit tests. If I debug the unit tests vstest.executionengine.x86.exe, it closes when the tests pass.

If I just run the tests (even if the test is as simple as just creating a new list without claims), vstest.executionengine.x86.exe does not close and remains in the task manager.

This causes me a problem when it comes to writing more complex tests, which include deleting files / cleaning SQL databases.

Any help would be appreciated.

EDIT:

Steps to play:

  • Create a new Unit Test project
  • Block debugging tests - vstest.executionengine.x86 opens and closes, passes the test.
  • Run block tests - vstest.executionengine.x86 opens and remains open.
+48
unit-testing testing visual-studio-2012
Nov 21
source share
6 answers

This is by design.

vstest.executionengine.exe restarts only when we detect a configuration change between two consecutive test runs. This helps to ensure that we do not accept performance when restarting the process unnecessarily.

Product Update With VS2013, we have a new menu item under Test → Test Settings called “Keep Engine Execution Engine Running”. You can clear this check box to opt out of the default behavior.

+56
Dec 05 '12 at 5:16
source share

I worked on this using the following as a pre-build event in the affected test projects:

for 64-bit:

taskkill /F /IM vstest.executionengine.exe /FI "MEMUSAGE gt 1" 

or for 32-bit:

 taskkill /F /IM vstest.executionengine.x86.exe /FI "MEMUSAGE gt 1" 

This silently kills the execution engine before creating a test project. /FI "MEMUSAGE gt 1" stops the execution of the command (and therefore assembly) if the execution engine is not running.

+40
Feb 03 '13 at 21:12
source share

What is its value, I came across this situation, and it turned out that I had a test that incorrectly cleared all its resources. In my particular case, there was a background thread with an open network connection, which did not close until the test came out. I don’t know why the exit from the test didn’t close it for me, but when I corrected my code to properly manage all open resources, everything worked as expected. I did not need to add hacks to kill vstest.executionengine.exe , and I did not have to give up Test -> Test Settings -> Keep Test Execution Engine Running

+5
May 02 '15 at 10:20
source share

I had this problem when running a test using the Resharper test runner, which does not seem to match the Test-->Test Settings-->Keep Test Execution Engine Running setting. In my case, this caused build failures with the following error:

warning MSB3026: Failed to copy "... \ SQLite.Interop.dll" to "bin \ Debug \ x86 \ SQLite.Interop.dll". Start of repetition 10 in 1000 ms. The process cannot access the file 'bin \ Debug \ x86 \ SQLite.Interop.dll' because it is being used by another process.

Adding a pre-build event to a test project, as @HappyCat suggested for me. I also needed to wrap it in an if statement so that it would not work on the build server and not interfere with other tasks.

 if $(ConfigurationName) == Debug ( echo "attempting to kill vstest to prevent access denied on sqlite.interop.dll" taskkill /F /IM vstest.executionengine.x86.exe /FI "MEMUSAGE gt 1" ) 
+2
Mar 16 '17 at 15:43
source share

I know this is old, but I thought that I would throw something I just discovered.

In the test that I ran, there were some objects in it that implemented IDisposable , so code analysis told me to have my test class. It took some time to figure this out, but when this.Dispose(); was getting a call to implement this interface, when I put it in my test class, it actually threw a StackOverflow exception. So I just pulled the interface and let the CA keep whining.

I did not need to switch "Keep Engine Execution Engine Running".

+1
Sep 25 '14 at 19:11
source share

The easiest approach is to go to the Windows task manager. Notice the vstest.executionengine.exe process running in the background. Kill this process, and now it should work fine.

0
Jul 16 '19 at 4:19
source share



All Articles