I'm trying to run code coverage testing from command line using below commands:
vstest.console.exe CoverTest.dll /EnableCodeCoverage /ResultsDirectory:"C:\btstack\apps\projects\CoverageTest\TestResults\result_1.coverage"
And I'm seeing following error but test is able to proceed.
C:\btstack\apps\projects\CoverageTest\coverage_test>vstest.console.exe CoverTest.dll /EnableCodeCoverage /ResultsDirectory:"C:\btstack\apps\projects\CoverageTest\TestResults"
Microsoft (R) Test Execution Command Line Tool Version 16.3.0-preview-20190715-02
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
Data collector 'Code Coverage' message: Data collector 'Code Coverage' failed to provide initialization information. Error: System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.Diagnostics.Logging.ProfilerInterop' threw an exception. ---> Microsoft.VisualStudio.Diagnostics.Common.InvariantException: Failed to load IntelliTrace Profiler binary or failed to locate functions.
Diagnostic Messages Collected when attempting to load the profiler dll
Process is 64bit : True
ProfilerDLL : x64\Microsoft.IntelliTrace.Profiler.dll
Attempting to locate ProfilerDLL relative the executing assembly. Assembly: Microsoft.IntelliTrace.Core, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\TestPlatform\x64\Microsoft.IntelliTrace.Profiler.dll
Attempting to locate ProfilerDLL relative to current process. Process: datacollector. Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\TestPlatform\x64\Microsoft.IntelliTrace.Profiler.dll
Attempting to locate ProfilerDLL relative the IntelliTrace install directory: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\x64\Microsoft.IntelliTrace.Profiler.dll
===============================================================================
---> System.ComponentModel.Win32Exception: The system cannot find the path specified
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Diagnostics.Common.Check.Throw[XT](String message, Func`1 innerEx)
at Microsoft.VisualStudio.Diagnostics.Logging.ProfilerInterop.ThrowInvariantExceptionOnZeroPtr(IntPtr ptr, String message)
at Microsoft.VisualStudio.Diagnostics.Logging.ProfilerInterop.InitInterop()
at Microsoft.VisualStudio.Diagnostics.Logging.ProfilerInterop..cctor()
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Diagnostics.Logging.ProfilerInterop.get_InteropInterface()
at Microsoft.VisualStudio.Diagnostics.Logging.LoggingConfig.Publish()
at Microsoft.VisualStudio.TraceCollector.CommonDataCollector.InitiateCollection()
at Microsoft.VisualStudio.TraceCollector.CommonDataCollector.GetEnvironmentVariables()
at Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector.GetEnvironmentVariables()
at Microsoft.VisualStudio.TestPlatform.Common.DataCollector.DataCollectorInformation.SetTestExecutionEnvironmentVariables()
at Microsoft.VisualStudio.TestPlatform.Common.DataCollector.DataCollectionManager.GetEnvironmentVariables(Boolean& unloadedAnyCollector).
√ TestMethod1 [52s 608ms]
Test Run Failed.
Total tests: 1
Passed: 1
Total time: 53.8182 Seconds
After I stop the coverage I'm not able to see the report getting generated in the location given "C:\btstack\apps\projects\CoverageTest\TestResults\5b7e122b-d0bd-42ca-8592-f4f68ddf235a\ <Empty>"
Please let me know how to solve this.
Thanks!