I recently installed VS2019 Prof 16.2 and experience following error when loading .coverage
files:
Microsoft Visual Studio
Exception was thrown: Could not load file or assembly 'Microsoft.VisualStudio.Coverage.Analysis,
Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
one of its dependencies. The system cannot find the file specified.
I know that usually it meant (for previous VS versions) that you need to run tests first and then load coverage file, but now for 2019 16.2 it doesn't work. However, loading this same coverage file works in VS2017 Community 15.9.14
The Microsoft.VisualStudio.Coverage.Analysis.dll
is located in C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\TestPlatform
and has version 16.0.28223.3002
Is somebody else experiencing this issue?
A test project configured to reproduce issue can be found on my git https://github.com/miqm/playground/tree/master/SchedulingApp
To generate .coverage
I run dotnet test -s Default.runsettings
and then I use File -> Open to load it to VS.
I tried to run VS with /logs enabled but nothing meaningful came up. Only logs around the time I tried to open coverage are those:
<entry>
<record>777</record>
<time>2019/08/03 20:48:17.804</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Begin package load [Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage, Microsoft.VisualStudio.QualityTools.TestCaseManagement, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
<guid>{A9405AE6-9AC6-4F0E-A03F-7AFE45F6FCB7}</guid>
</entry>
<entry>
<record>778</record>
<time>2019/08/03 20:48:18.097</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Begin package load [Microsoft.VisualStudio.TestTools.Tips.TuipPackage.TuipPackage, Microsoft.VisualStudio.QualityTools.Tips.TuipPackage, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
<guid>{52CBD135-1F97-2580-011F-C7CD052E44DE}</guid>
</entry>
<entry>
<record>779</record>
<time>2019/08/03 20:48:18.152</time>
<type>Information</type>
<source>VisualStudio</source>
<description>End package load [Microsoft.VisualStudio.TestTools.Tips.TuipPackage.TuipPackage, Microsoft.VisualStudio.QualityTools.Tips.TuipPackage, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
<guid>{52CBD135-1F97-2580-011F-C7CD052E44DE}</guid>
</entry>
<entry>
<record>780</record>
<time>2019/08/03 20:48:18.164</time>
<type>Information</type>
<source>VisualStudio</source>
<description>End package load [Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage, Microsoft.VisualStudio.QualityTools.TestCaseManagement, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
<guid>{A9405AE6-9AC6-4F0E-A03F-7AFE45F6FCB7}</guid>
</entry>
Any help appreciated.
On the Test menu, select Analyze Code Coverage for All Tests. You can also run code coverage from the Test Explorer tool window. Show Code Coverage Coloring in the Code Coverage Results window. By default, code that is covered by tests is highlighted in light blue.
In Visual Studio, click File > Open > File, navigate to the output directory of the solution, and select and open the run. coverage file.
Please right-click your . coverage file to choose open with -> Notepad. Then it will shown with XML content in that file. And you also can change the .
According to Microsoft response on bug report (https://developercommunity.visualstudio.com/content/problem/676360/cannot-open-coverage-file-from-visual-studio-2019.html) it turns out, that opening Coverage files is feature of Enterprise edition only.
Reason why it was (and is) working on 2017 Community and Professional and 2019 <16.2 was a glitch, that after running all tests, the missing assembly was loaded and coverage could be opened.
To bring back opening coverage files on Professional (and perhaps Community as well, didn't test it), we need to add ;Extensions\TestPlatform
at the end of <probing privatePath=""/>
list in %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\16.0_
somehash\devenv.exe.config
file.
or....
Copy
Common7/IDE/Extensions/TestPlatform/Microsoft.VisualStudio.Coverage.Analysis.dll
Common7/IDE/Extensions/TestPlatform/Microsoft.VisualStudio.Coverage.Interop.dll
to
Common7/IDE/PrivateAssemblies
To open coverage file, as error states, dll file is required. That file, in Enterprise Edition, is located and loaded from: Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Coverage.Analysis.dll
However, same file is in Common7\IDE\Extensions\TestPlatform
. So we have required assembly file, but devenv doesn't know it is there.
In %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\
there are subfolders like 16.0_hash which contain devenv.exe.config
files specifying required assembles and their locations.
In each of the file there's also <probing>
entry that specifies additional locations to tell devenv.exe where to look for dll assemblies. Enterprise and Professional has equal entry, but since Enterprise version has missing file in PrivateAssemblies
folder, which is on this list, devenv is loading it.
So we need either to copy dll files from TestExtensions to PrivateAssemblies or add the folder path to probing list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With