Skip to content

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

@thoma01

Description

@thoma01

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocking-usersIssue is blocking some users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions