Not able to run unit tests when Visual Studio 2010 and Visual Studio 2012 are installed side by side?


If you are not able to run unit tests when VS 2010 and VS 2012 are installed on the same machine, then please read on. There is a known issue here and this post talks about how you can verify that you are running into the same issue or not and secondly how you can come out of it.

If you are running into the same issue, then you will observe that the test run is stuck and is not proceeding at all. This behavior is applicable for runs initiated from VS as well as runs initiated from MSTest or MTM.

To confirm whether you are hitting the same issue or not, you can try out any of the following steps.

  • Enable the test agent logs (QTAgent32.exe) and you should observe the following error in it.

QTAgent32.exe, PID 1944, Thread 6) AgentObject.OnBackgroundSendTestMessage: Connection to controller was lost. System.Runtime.Remoting.RemotingException: The argument type ‘Run {b664e4b9-5d75-43b8-a8d3-95af9bf880bf}, Test {ccee0286-b042-4feb-bb72-7fbea29f9bc0}: Started’ cannot be converted into parameter type ‘Microsoft.VisualStudio.TestTools.Common.TestMessage’. —> System.InvalidCastException: Object must implement IConvertible.

Or

  • Try running the test using MSTest and observe that by default it gets stuck but if you execute it /noisolation switch, then it works fine.

To fix this problem, you should upgrade your 2010 component (VS or test controller or test agent) to 2010 SP1 and after that it will work perfectly fine.

Comments (11)

  1. Ralph says:

    Thank you for your blog. I had the first error and installing SP1 on my build server solved the issue.

  2. Alex says:

    Yes, thank you VERY much. This little problem cost me several precious hours, and it would have cost more had you not posted this.

  3. I'm not able run Unit Tests after installing SP1 for VS when vs2010 and vs2012 are installed side by side :(. What else I can do?

  4. Finally I found out solution. I just removed all dll-s which were referencing to VS11 to reference dlls from  VS10 "C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEPublicAssemblies".

  5. Charles says:

    This is happening also when VS 2010 and 2013 are running side by side

  6. Vivek says:

    Thanks a lot. I was struggling a lot to fix this issue. As per the suggestion, I installed VS 2010 SP1 and now everything works fine.

  7. Luis Banda says:

    Hi, I just installed Visual Studio 2010 SP1 on my server,  but I'm still having troubles with MSTest, do I need to restart the server? do you configure something else?

  8. Miro77 says:

    You just save my day instead to diving in…

  9. Micro Farad says:

    I am having a very similar issue but on a TFS 2012 build server running the VS2013 build tools, on a machine that has previously had VS2010 (with SP1) installed. I am having difficulty getting to those log files, I'll try again soon. I tried using the /noisolation flag but the tests still hang. This has become a critical issue for me to resolve as 50% or even more of our builds are hanging when they get to unit test. I am actively debugging this and any expert advice would be greatly appreciated. If there's a piece of information you'd like me to give or an experiment you would like me to try, let me know. I am determined to solve this.

  10. Micro Farad says:

    My case was not an MSTest bug. It was a bug in our own software. Oops.

  11. Leonardo Cruz says:

    Thank you. This solution worked to me.