locked
Problem running Unit Tests in Visual Studio 2008 RRS feed

  • Question

  • I have been running unit tests on my workstation for Visual Studio 2008, and the other day, it fails returning an error "Test host process exited unexpectedly" without running any tests.  Not only are the tests in the project that I was working on, no longer working, but also in a brand new project I created.  The tests will run in another machine, but I am trying to debug what happened here, so I don't have to waste the time re-installing Visual Studio 2008.

    I looked into it futher using procmon from SysInternals, and it looks like vstesthost.exe is terminating unexpectedly.  Somewhere in the messages, it lists that vstesthost.exe cannot find the file "Microsoft.VisualStudio.QualityTools.Common.dll" first in the GAC, then in the IDE directory.  On a working machine, after vstesthost.exe cannot find the file in the GAC, it finds it in the PrivateAssemblies folder.  Why would the vstesthost.exe stop looking in the PrivateAssemblies folder?  When I try to debug the tests on the non-working machine, it fails with unable to find "Microsoft.VisualStudio.QualityTools.Common.dll".  How do I get it to work again?

    As an additional note, running the tests under mstest.exe also fails, unless I use the /noisolation flag.  Based on what I see, mstest.exe also tries to create a vstesthost, unless I use that flag.

    Saturday, January 5, 2013 6:38 AM

Answers

  • Hello Bob,

    Glad to receive your reply.

    Generally after installing VS, the Microsoft.VisualStudio.QualityTools.Common assembly should be installed in the GAC. You can check if it is there from %WinDir%/assembly.

    You also can check if it locates at disk:<Microsoft Visual Studio 8.0>\Common7\IDE\PublicAssemblies.

    If you can’t find it, I suspect it is caused by an installation problem. I suggest that you can uninstall the VS2008 completely and then reinstall it to correct it.

    If you can find it in GAC/PrivateAssembly, you can try to re-add ”Microsoft.VisualStudio.QualityTools.Common” reference to your project and set the DLL’s property “Copy Local” to “False” to check the result.

    In addition, in the following thread with similar issue, you can refer to the assembly resolver provided bt Vinoth which may help you:

    http://social.msdn.microsoft.com/Forums/en/vsautotest/thread/e74f4a8a-5a28-453f-943d-1c7cd5665444

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Amanda Zhu Thursday, January 10, 2013 8:25 AM
    • Marked as answer by Amanda Zhu Friday, January 11, 2013 1:10 AM
    Tuesday, January 8, 2013 1:57 AM

All replies

  • Hello Bob,

    Thank you for your post.

    According to your description, do you mean that you can get the error "Test host process exited unexpectedly" when you don't run tests? If you r-create a new simple unit test, will you get this issue?

    If yes, and based on your further information, I doubt that the issue is related to your Visual Studio or system environment.

    Run the following steps in the command line, and then create and run a new unit test to check the result.

    Devenv.exe /ResetSettings: Restores the IDE's default settings, optionally resets to the specified VSSettings file.

    Devenv.exe /ResetAddin: Removes commands and command UI associated with the specified Add-in.

    Devenv.exe /ResetSkipPkgs: Clears all SkipLoading tags added to VSPackages.

    Devenv.exe /SafeMode: Starts Visual Studio in safe mode, and loads only the default environment and services, and shipped versions of third-party packages.

    For more information, please see: http://msdn.microsoft.com/en-us/library/xee0c8y7(v=vs.90).aspx

    Also you can try deploying the missing assemblie in the Deployment tab in the testrunconfig file to check the result. And you can copy Microsoft.VisualStudio.QualityTools.Common.dll into the PrivateAssemblies folder and then re-reference it into the test project.

    Similar thread:

    http://social.msdn.microsoft.com/Forums/en-NZ/vststest/thread/aa7f7567-faba-4589-b0ae-fe8d2c831c7a

    If still no help, I suggest that you try to repair the VS to check if it can help if you don't want to reinstall it.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Sunday, January 6, 2013 6:37 AM
  • Thank you for the suggestions.  Yes, I get that error when I try to run any test project, including a fresh one that I just created.  Running the tests returns a report that reads:

    Test host process exited unexpectedly.
    Failed to queue test run '[Username]@[Workstation] 2013-01-07 09:45:08': Test host process exited unexpectedly.

    Debugging the test, gets me an error that reads:

    Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.


    I tried the flags below, and closed the IDE each time.  No help, after I re-opened the IDE, after the last step.

    /ResetSettings ..............No help

    /ResetAddin ..............No help /ResetSkipPkgs ..............No help

     /SafeMode ..............No help

    Thanks for your help.  It may be easier to re-install Visual Studio, but if you have one more suggestion, I may try that.  


    Monday, January 7, 2013 3:05 PM
  • Hello Bob,

    Glad to receive your reply.

    Generally after installing VS, the Microsoft.VisualStudio.QualityTools.Common assembly should be installed in the GAC. You can check if it is there from %WinDir%/assembly.

    You also can check if it locates at disk:<Microsoft Visual Studio 8.0>\Common7\IDE\PublicAssemblies.

    If you can’t find it, I suspect it is caused by an installation problem. I suggest that you can uninstall the VS2008 completely and then reinstall it to correct it.

    If you can find it in GAC/PrivateAssembly, you can try to re-add ”Microsoft.VisualStudio.QualityTools.Common” reference to your project and set the DLL’s property “Copy Local” to “False” to check the result.

    In addition, in the following thread with similar issue, you can refer to the assembly resolver provided bt Vinoth which may help you:

    http://social.msdn.microsoft.com/Forums/en/vsautotest/thread/e74f4a8a-5a28-453f-943d-1c7cd5665444

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Amanda Zhu Thursday, January 10, 2013 8:25 AM
    • Marked as answer by Amanda Zhu Friday, January 11, 2013 1:10 AM
    Tuesday, January 8, 2013 1:57 AM
  • Hello Bob,

    What about your issue now? Could you get useful information from our reply?

    Would you mind letting us know the result of the suggestion?

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, January 9, 2013 7:20 AM