Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 - Run Tests Fails and stuck in a loop

I need help, suddenly I cannot run tests in VS2015 for a specific solution (others work), I can debug tests successfully but not able to run them normally.

it builds the solution and then writes in the status bar "unexpected error detected ..." in the output tests it writes "the operation was canceled" and then repeats itself automatically, seems it enters into an infinite loop, I need to terminate VS in order to continue my work.

I've tried to log activities in VS but there is no information about an error that I could find there.

any thoughts on the cause of this ?

any suggestions on troubleshooting this ?

Update : apparently after some isolation I have found that the following PreBuild event caused this : set textTemplatingPath="%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" if %textTemplatingPath%=="\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" set textTemplatingPath="%CommonProgramFiles%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" %textTemplatingPath% "$(ProjectDir)AssemblyFileVersion.tt"

which is very wired since it worked before, any ideas ?

like image 359
Builder Bob Avatar asked Jan 02 '17 07:01

Builder Bob


2 Answers

If you have Resharper 2016.3.2 installed.

You might be hitting this bug:

RSRP-462481 "The operation was canceled" message in Test output during running test via Visual Studio runner with ReSharper enabled

If you disable the Unit Testing feature of R#, the test explorer is working again: enter image description here

like image 90
Andreas Willich Avatar answered Sep 20 '22 07:09

Andreas Willich


I have seen this behavior before. I have not determined the cause. There seem to be various possible causes.

  1. Number of unit tests. There are some numbers of tests that cause the "unexpected error." Adding one more unit test seems to allow all test to be run again, when this is the issue.

  2. Infinite loop in code under test. This will cause it to appear that the tests are not running and will display the "unexpected error" text.

  3. Debug mode not working. On one system, I find that I have to run in Release Mode configuration for my unit tests to work.

I don't know if any of these will work for you. VS2015 is very buggy. Definitely give them a shot though.

like image 40
Silas Reinagel Avatar answered Sep 19 '22 07:09

Silas Reinagel