This is what I'm getting when I build my Test project:
With this I'm unable to run my tests since they're not being discovered by VS.
See the message "Unexpected error detected. Check the Tests Output Pane for details."
at the window bottom. Now if you look at the Tests OUTPUT pane you'll have no clue about what's the problem. This is extremely helpful... :)
I know VS 11 is in beta but it used to work...
I've already restarted VS but it didn't work after that too.
Any ideas about what's going on? Would it be a bug somewhere?
Note: the only thing I can think is related with VS 2010 uninstall I did sometime ago. Maybe it uninstalled some necessary bits. Beats me...
EDIT 1
I just did a repair on VS 11 Beta Ultimate. It asked to reboot the computer once and I did. Then it continued the repair but kept working for more than 12 hours. I just killed the repair process.
In the meantime I uninstalled Visual Studio 11 Express for Web. I had this one side by side with VS 11 Beta Ultimate.
Crazily enough, it started working again after I did both things. So I don't know for sure what has solved the problem: the killed repair process or the uninstall of VS 11 Express for Web.
EDIT 2
For my disappointment now I see this is an intermittent thing. After restarting VS 11 Ultimate Beta the problem persists. :(
EDIT 3
I filled a Connect ticket at Microsoft but they closed it as not reproducible.
I made a 2nd try with VS 11 Ultimate Beta repair option and this time it finished as expected. To isolate the problem I created a brand new test project with a default UnitTest1.cs
file within a new Solution and after building it I get the same error screen as shown above. So the repair option did not solve the problem. Looks like something is missing in my system.
This is the info from VS About window:
Microsoft Visual Studio 11
Version 11.0.50323.1 QRELB
Microsoft .NET Framework
Version 4.5.50131 QRELB
Installed Version: Ultimate
EDIT 4
I found a similar problem here but the solution given there doesn't apply in my case since I do not have the DLL described.
EDIT 5
With the help of Aseem Bansal's (a Microsoft employee) I finally got the logs and saw this exception:
W, 2124, 19, 2012/04/19, 11:51:32.644, 53768626724, devenv.exe, Exception occured while initialization System.InvalidOperationException: Cannot start process because a file name has not been provided.
at System.Diagnostics.Process.Start()
at Microsoft.VisualStudio.TestPlatform.Core.Utilities.CommonUtilities.LaunchProcess(String exeFileName, String commandLineArguments, String workingDirectory, IDictionary`2 environmentVariables)
at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.SetupProcess(Boolean forceX86Discoverer)
at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.Initialize_NoLock(Boolean forceX86Discoverer)
at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.EnsureInitialized(Boolean forceX86Discoverer)
at Microsoft.VisualStudio.TestPlatform.Client.TestRunnerServiceClient.EnsureInitialized_NoError(Boolean forceDiscoveryInX86Mode)
EDIT 6
I tried executing the tests using the mstest.exe
command-line tool (with and without the /noisolation
option). The tests run as expected as can be seen here. So the problem is really something inside VS 11 Beta.
Found a correlation:
When NuGet auto-pull is enabled, I run into this issue on VS 11 after about ~15 builds. Deleting the Packages folder and forcing a re-pull of dependencies on build corrects.
I also noticed that if I manually purge the obj/bin folders in the solution root, the solution is corrected.
Therefore, I am thinking this sounds like the Test Suite is not updating cached dlls with that of the current solution configuration. As we edit, the dlls are getting out of sync and thus causing the unit test fixture to fail to initiate.
Hope this helps.
Leniel,
Thanks for raising this issue.
As we discussed here, it indicates that shadow copy is causing the problem.
Please ensure that the
Microsoft.VisualStudio.TestPlatform.Core.dll
is loaded from its installation location%VSInstallDir%\Commmon7\IDE\CommonExtensions\Microsoft\TestWindow
path and not from a temporary path like%appData%\assembly\dl3\
that you are observing right now. This should fix the problem for you.Also I wanted to update you that in the latest code, we have improved our logic and with the improved logic, it would not matter from where the binary is getting loaded and it would just work for you.
Regards
Aseem Bansal
I had this problem, I tried the suggestion in a comment by @chrisortman and it solved my problem.
He suggested deleting:
%appdata%\assembly\dl3
Although I found it here:
%appdata%..\..\Local\dl3
I was going mad. Truly mad.
Thanks Leniel and Aseem Bansal for you help.
I have similar problem, but solution with this post not help me, My VS 2012 + silk4net not load test in Test Explorer.
Before I removed Telerik Test Studio from my PC. But extension for VS not removed. After I removed this extensions started to work correctly. Who see the problem persists, please view extension may be a problem in them.
Hope this helps.
One more point:
Needs to add to end of each test during its clean-up! I learned this hard way. MS unit test framework checks this, and not run next test with non-zero ExitCode from previous test!
This is a very good thread, I solve almost all my unit test issues in this thread.