locked
Cmdline tool vstest.console.exe throws UnitTestIsolationException and stalls execution at some point RRS feed

  • Question

  • Hi,

    we are using Microsoft Visual Studio 2017 Enterprise on a Windows 2016 Standard (1607) server. During direct execution of vstest.console.exe on our .NET WPF application we are getting several errors leading to suspicion, that there might be a bug or a corrupt installation of Visual Studio 2017.

    The setup is a Jenkins Slave running as a service under "nt authority\system" using Visual Studio 2017 for building and unit testing our project files. During execution of the unit tests via

    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" "Application.Unittests.Test.dll" /Platform:x86 /Logger:trx

    we are getting repeatedly following error message.

    Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to get profiler module handle 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\IntelliTrace\ProfilerProxy\x86\Microsoft.IntelliTrace.ProfilerProxy.dll'. The specified module could not be found ---> System.ComponentModel.Win32Exception: The specified module could not be found
    Stack Trace:
        at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.LibraryMethods.GetModuleHandle(String fileName)
       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.LoadProfilerModule(String profilerPath)
     --- End of inner exception stack trace ---
        at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.LoadProfilerModule(String profilerPath)
       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.Initialize()
       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()...

    We have an identical setup on a different server using Enterprise Visual Studio 2015 and 2017. The 2015 execution runs fine, whereas the 2017 on the this server displays the same error as above.

    Did we miss something along the way from 2015 to 2017?

    Wednesday, April 10, 2019 1:39 PM

All replies

  • Hi Silvio Wiedrich,

    Welcome to MSDN forum.

    Please have a try the following steps :

    >>check if the "intelliTrace" is installed in the visual studio installer

    >> open the the test project with vs2017, remove dll file in your solution explorer window, then re-add the new version dll file which is called "Microsoft.QualityTools.Testing.Fakes.dll" under the vs2017 installation path "C:\Program Files (x86)\Microsoft Visual Studio\Common7\IDE\PublicAssemblies".

    If it persists, please feel free to share update information with us. Look forward to your reply.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, April 11, 2019 11:19 AM
  • Dear Dylan,

    thanks for your reply. In fact we had indeed an issue with the wrong location of the "Microsoft.QualityTools.Testing.Fakes.dll". Your solution helped one step forward.

    I fixed the references, but now got stuck with a different exception message. Researching the internet I had no luck finding a solution for the following trace:

     Test method XXXXXXXXXXXXXXXXX threw exception: 

    Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Unexpected error returned by SetDetourProvider in profiler library 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\Microsoft.IntelliTrace.Profiler.dll'.
    Stack Trace:
        at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.Initialize()
       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()
       at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.CreateContext()
       at Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create()
       at XXXXXXXXXXXXXXXXXXXXX in XXXXXXXXXXXXXXXXXXXXXX

    Furthermore, the execution of vstest.console got stuck (reproducible) with the following log in 

    (A) testhost log:

    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:02.236, 653641290447, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:03.252, 653643869336, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:04.252, 653646408316, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:05.267, 653648986921, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:06.267, 653651526009, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:07.283, 653654104690, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:08.283, 653656643979, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:09.283, 653659182916, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:10.289, 653661737688, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603
    TpTrace Verbose: 0 : 9184, 9, 2019/04/12, 14:21:11.291, 653664281491, testhost.x86.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49602 localEndPoint: 127.0.0.1:49603

    ....

    (B) Diag Log

    TpTrace Verbose: 0 : 14388, 11, 2019/04/12, 14:22:18.507, 653834948397, vstest.console.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49603 localEndPoint: 127.0.0.1:49602
    TpTrace Verbose: 0 : 14388, 11, 2019/04/12, 14:22:19.512, 653837499614, vstest.console.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49603 localEndPoint: 127.0.0.1:49602
    TpTrace Verbose: 0 : 14388, 11, 2019/04/12, 14:22:20.528, 653840078217, vstest.console.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49603 localEndPoint: 127.0.0.1:49602
    TpTrace Verbose: 0 : 14388, 11, 2019/04/12, 14:22:21.528, 653842617395, vstest.console.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:49603 localEndPoint: 127.0.0.1:49602

    ....

    (C) Data Collector log:

    TpTrace Warning: 0 : 11368, 6, 2019/04/12, 14:16:20.306, 652925453159, datacollector.exe, Data collector 'datacollector://microsoft/CodeCoverage/2.0' logged the following warning: No Microsoft .NET applications were launched during the test run. Launch applications from Explorer or a new command prompt after a test case has started. If no .NET application is being tested, disable the Test Impact and IntelliTrace diagnostic data adapters.
    TpTrace Error: 0 : 11368, 6, 2019/04/12, 14:16:20.306, 652925453498, datacollector.exe, DataCollectionAttachmentManager.GetAttachments: Fail to get attachments: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
       at System.ThrowHelper.ThrowKeyNotFoundException()
       at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       at Microsoft.VisualStudio.TestPlatform.Common.DataCollector.DataCollectionAttachmentManager.GetAttachments(DataCollectionContext dataCollectionContext) 
    TpTrace Information: 0 : 11368, 6, 2019/04/12, 14:16:20.306, 652925453716, datacollector.exe, DataCollectionTestCaseEventHandler: Test case completed
    TpTrace Information: 0 : 11368, 6, 2019/04/12, 14:16:20.307, 652925455437, datacollector.exe, DataCollectionTestCaseEventHandler: Test case starting.
    TpTrace Information: 0 : 11368, 6, 2019/04/12, 14:16:20.307, 652925456131, datacollector.exe, DataCollectionTestCaseEventHandler: Test case started.
    TpTrace Information: 0 : 11368, 6, 2019/04/12, 14:16:20.308, 652925458146, datacollector.exe, DataCollectionTestCaseEventHandler : Test case completing.
    TpTrace Warning: 0 : 11368, 6, 2019/04/12, 14:16:20.308, 652925458908, datacollector.exe, Data collector 'datacollector://microsoft/CodeCoverage/2.0' logged the following warning: No Microsoft .NET applications were launched during the test run. Launch applications from Explorer or a new command prompt after a test case has started. If no .NET application is being tested, disable the Test Impact and IntelliTrace diagnostic data adapters.

    Maybe you came across this issue before?

    It is worth to mention, that the execution in turn works successfully using a "standard user account", but not as a service account "nt authority\system".

    Thanks in advance,

    Silvio

    Friday, April 12, 2019 12:28 PM
  • Hi Silvio,

    Sorry for delay in reply.

    Please try to update your visual studio 2017 to the newest version.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, April 15, 2019 10:23 AM
  • Hi Dylan,

    thanks for your response.

    In order to rule out any update issue, we already updated the Visual Studio installation to Version 15.9.11. So this might not be the cause of the issue. 

    But to rule out further any missed updates, here the version numbers of the relevant components:

    ** Visual Studio 2017 Developer Command Prompt v15.9.11

    ------------------------------------------------------------------------

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise>msbuild /version
    Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.

    15.9.21.664

    ------------------------------------------------------------------------

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise>vstest.console /?
    Microsoft (R) Test Execution Command Line Tool Version 15.9.1
    Copyright (c) Microsoft Corporation.  All rights reserved.

    ------------------------------------------------------------------------

    PS C:\Users\ada1wiedrsi> (Get-Command "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Public
    Assemblies\Microsoft.QualityTools.Testing.Fakes.dll").FileVersionInfo.FileVersion
    15.0.27924.0

    ------------------------------------------------------------------------

    PS C:\Users\ada1wiedrsi> (Get-Command "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Common
    Extensions\Microsoft\IntelliTrace\Microsoft.IntelliTrace.Profiler.dll").FileVersionInfo.FileVersion
    15.0.28307.421 built by: D15.9

    ------------------------------------------------------------------------

    PS C:\Users\ada1wiedrsi> (Get-Command "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extens
    ions\TestPlatform\testhost.x86.exe").FileVersionInfo.FileVersion
    15.0.0

    And the version info from the About Box in Visual Studio:

    Microsoft Visual Studio Enterprise 2017 
    Version 15.9.11
    VisualStudio.15.Release/15.9.11+28307.586
    Microsoft .NET Framework
    Version 4.6.01586

    Installed Version: Enterprise

    Visual C++ 2017   00369-90253-85430-AA202
    Microsoft Visual C++ 2017

    Application Insights Tools for Visual Studio Package   8.14.20131.1
    Application Insights Tools for Visual Studio

    ASP.NET and Web Tools 2017   15.9.04012.0
    ASP.NET and Web Tools 2017

    ASP.NET Core Razor Language Services   15.8.31590
    Provides languages services for ASP.NET Core Razor.

    ASP.NET Web Frameworks and Tools 2017   5.2.61435.0
    For additional information, visit https://www.asp.net/

    Azure App Service Tools v3.0.0   15.9.03024.0
    Azure App Service Tools v3.0.0

    Azure Data Lake Node   1.0
    This package contains the Data Lake integration nodes for Server Explorer.

    Azure Data Lake Tools for Visual Studio   2.3.3000.2
    Microsoft Azure Data Lake Tools for Visual Studio

    Azure Functions and Web Jobs Tools   15.9.03024.0
    Azure Functions and Web Jobs Tools

    Azure Stream Analytics Tools for Visual Studio   2.3.3000.2
    Microsoft Azure Stream Analytics Tools for Visual Studio

    C# Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Common Azure Tools   1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

    Cookiecutter   15.9.18254.1
    Provides tools for finding, instantiating and customizing templates in cookiecutter format.

    Extensibility Message Bus   1.1.49 (remotes/origin/d15-8@ee674f3)
    Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

    Fabric.DiagnosticEvents   1.0
    Fabric Diagnostic Events

    JavaScript Language Service   2.0
    JavaScript Language Service

    Microsoft Azure HDInsight Azure Node   2.3.3000.2
    HDInsight Node under Azure Node

    Microsoft Azure Hive Query Language Service   2.3.3000.2
    Language service for Hive query

    Microsoft Azure Service Fabric Tools for Visual Studio   2.4
    Microsoft Azure Service Fabric Tools for Visual Studio

    Microsoft Azure Stream Analytics Language Service   2.3.3000.2
    Language service for Azure Stream Analytics

    Microsoft Azure Stream Analytics Node   1.0
    Azure Stream Analytics Node under Azure Node

    Microsoft Azure Tools   2.9
    Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.0.0

    Microsoft Continuous Delivery Tools for Visual Studio   0.4
    Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

    Microsoft JVM Debugger   1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

    Microsoft Library Manager   1.0
    Install client-side libraries easily to any web project

    Microsoft MI-Based Debugger   1.0
    Provides support for connecting Visual Studio to MI compatible debuggers

    Microsoft Visual C++ Wizards   1.0
    Microsoft Visual C++ Wizards

    Microsoft Visual Studio Tools for Containers   1.1
    Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

    Microsoft Visual Studio VC Package   1.0
    Microsoft Visual Studio VC Package

    MLGen Package Extension   1.0
    MLGen Package Visual Studio Extension Detailed Info

    Mono Debugging for Visual Studio   4.13.12-pre (9bc9548)
    Support for debugging Mono processes with Visual Studio.

    NuGet Package Manager   4.6.0
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

    ProjectServicesPackage Extension   1.0
    ProjectServicesPackage Visual Studio Extension Detailed Info

    Python   15.9.18254.1
    Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

    Python - Django support   15.9.18254.1
    Provides templates and integration for the Django web framework.

    Python - IronPython support   15.9.18254.1
    Provides templates and integration for IronPython-based projects.

    Python - Profiling support   15.9.18254.1
    Profiling support for Python projects.

    R Tools for Visual Studio   1.3.40517.1016
    Provides project system, R Interactive window, plotting, and more for the R programming language.

    ResourcePackage Extension   1.0
    ResourcePackage Visual Studio Extension Detailed Info

    ResourcePackage Extension   1.0
    ResourcePackage Visual Studio Extension Detailed Info

    Snapshot Debugging Extension   1.0
    Snapshot Debugging Visual Studio Extension Detailed Info

    SQL Server Data Tools   15.1.61903.01040
    Microsoft SQL Server Data Tools

    Test Adapter for Boost.Test   1.0
    Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

    Test Adapter for Google Test   1.0
    Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

    ToolWindowHostedEditor   1.0
    Hosting json editor into a tool window

    TypeScript Tools   15.9.20918.2001
    TypeScript Tools for Microsoft Visual Studio

    Visual Basic Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Visual F# Tools 10.2 for F# 4.5   15.8.0.0.  Commit Hash: 6e26c5bacc8c4201e962f5bdde0a177f82f88691.
    Microsoft Visual F# Tools 10.2 for F# 4.5

    Visual Studio Code Debug Adapter Host Package   1.0
    Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

    Visual Studio Tools for CMake   1.0
    Visual Studio Tools for CMake

    Visual Studio Tools for Containers   1.0
    Visual Studio Tools for Containers

    VisualStudio.Mac   1.0
    Mac Extension for Visual Studio

    WiX Toolset Visual Studio Extension   0.9.21.62588
    WiX Toolset Visual Studio Extension version 0.9.21.62588
    Copyright (c) .NET Foundation and contributors. All rights reserved.

    Xamarin   4.12.3.83 (d15-9@23fa80172)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

    Xamarin Designer   4.16.30 (e0af99a34)
    Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

    Xamarin Templates   1.1.128 (6f5ebb2)
    Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

    Xamarin.Android SDK   9.1.7.0 (HEAD/ba9da7a76)
    Xamarin.Android Reference Assemblies and MSBuild support.

    Xamarin.iOS and Xamarin.Mac SDK   12.4.0.64 (9c8d8e0)
    Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

    Thanks for your support.

    Kind regards,

    Silvio

    Tuesday, April 16, 2019 6:12 AM
  • Hi Silvio,

    Thank you for reply.

    >>Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: ...\Microsoft.IntelliTrace.Profiler.dll'.

    Please have a try to remove the fakes folder then right-click your reference and re-add the fakes assembly.

    >>the execution of vstest.console got stuck 

    According to the logs, it seems that there are two or more tests running in parallel causing a deadlock. Please check similar issue for more information.

    >>the execution in turn works successfully using a "standard user account", but not as a service account "nt authority\system"

    It is more related to Jenkins, we suggest you go to stack overflow with Jenkins tag to get better support.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com



    Friday, April 19, 2019 10:37 AM
  • Hi Silvio,

    Sorry for bothering you.

    It seems that you have solved this issues. If the answer is helpful for you, please mark it as answer. And we will also appreciate to share the solution here. It will be beneficial to other community members which have the similar issue.

    Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, April 23, 2019 7:18 AM