question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

datacollector.exe Unable to instrument module: Could not load file or assembly 'System.Reflection.Metadata, Version=1.4.2.0'

See original GitHub issue

Test project created with xUnit v2.4.1 and Microsoft.NET.Test.Sdk v17.1.0 and coverlet.collector v3.1.2

Error from log.datacollector.txt

TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101538449, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Resolving assembly.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101539974, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'REST.Test\publish'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101544437, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: File exists but version/public key is wrong. Try next extension.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101545465, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'publish\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101545985, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\Extensions'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101546955, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\Extensions\System.Reflection.Metadata.dll', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101547941, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\Extensions\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101548431, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\Extensions\V1'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101549452, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\Extensions\V1\System.Reflection.Metadata.dll', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101550684, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\Extensions\V1\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101551193, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101556124, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: File exists but version/public key is wrong. Try next extension.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.797, 23045101557219, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.798, 23045101557775, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\PrivateAssemblies'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.798, 23045101562500, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: File exists but version/public key is wrong. Try next extension.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.798, 23045101563591, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\PrivateAssemblies\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.798, 23045101564101, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\PublicAssemblies'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.798, 23045101564998, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\PublicAssemblies\System.Reflection.Metadata.dll', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.798, 23045101565946, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\PublicAssemblies\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.798, 23045101566440, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.798, 23045101567333, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\System.Reflection.Metadata.dll', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.799, 23045101568309, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.799, 23045101568827, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.799, 23045101569940, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\System.Reflection.Metadata.dll', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.799, 23045101571232, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.799, 23045101571778, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Searching in: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE'.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.799, 23045101572713, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\System.Reflection.Metadata.dll', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.799, 23045101573735, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Assembly path does not exist: 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\System.Reflection.Metadata.exe', returning.
TpTrace Information: 0 : 17336, 1, 2022/05/09, 14:42:45.799, 23045101574786, datacollector.exe, AssemblyResolver.OnResolve: System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a: Failed to load assembly.
TpTrace Warning: 0 : 17336, 1, 2022/05/09, 14:42:45.818, 23045101763017, datacollector.exe, [coverlet]Unable to instrument module: 'publish\REST.dll'
System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at Coverlet.Core.Helpers.InstrumentationHelper.HasPdb(String module, Boolean& embedded)
   at Coverlet.Core.Instrumentation.Instrumenter.CanInstrument() in /_/src/coverlet.core/Instrumentation/Instrumenter.cs:line 92

It seems in Microsoft.NET.Test.Sdk v17.1.0 they use System.Reflection.Metadata v1.6.0 which is conflicting.

coverlet.runsettings file

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
 <DataCollectors>
   <DataCollector friendlyName="XPlat Code Coverage">
     <Configuration>
       <Format>cobertura</Format>
       <Include>[REST*]*</Include>
     </Configuration>
   </DataCollector>
 </DataCollectors>
</DataCollectionRunSettings>
</RunSettings>

Query to run tests with code coverage

vstest.console.exe REST.Test\publish\REST.Test.dll /Collect:"XPlat Code Coverage" /settings:coverlet.runsettings /diag:TestResults\log.txt

This error is blocking me from making any progress with coverlet. Any help would be greatly appreciated.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
MarcoRossignolicommented, May 19, 2022

Thanks for reporting it I’ll take a look asap.

0reactions
thoma01commented, Jun 9, 2022

@tonyhallett I will give it a try locally, and hopefully that will work. If so, I can use that temporarily in a local environment to get some results. Ultimately this method will not be possible in my CI/CD environments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

visual studio code issues
__label__bug "Manually filling out the ""ALE"" version of the form doesn't download with some fields I've noticed that the following fields aren't being ......
Read more >
Untitled
Firewire dominator vs spitfire audio, Change exe file icon windows 7, ... It can't happen here ebook3000, Bajar el lag del minecraft mods....
Read more >
https://gitweb.gentoo.org/repo/sync/gentoo.git/pla...
acct-group/adm 0: System group: adm acct-group/audio 0: System group: audio acct-group/bacula 0: A group for the bacula backup system acct-group/bitcoin 0: ...
Read more >
PS Package Management Packages 24-APR-2016 .xlsx
7-Zip is a file archiver with a high compression ratio. 7Zip4Powershell. 1.3.0. PSGallery. Powershell module for creating and extracting ...
Read more >
CVE - Search Results - MITRE
The mission of the CVE® Program is to identify, define, and catalog publicly disclosed cybersecurity vulnerabilities.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found