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.

System.MissingMethodException with collectors on .NET 5

See original GitHub issue

This is the first time trying coverlet but I cannot get it to work with either version 3.0.0 nor 1.3.0

This is my minimal test repository: https://github.com/fredrikcarlbom/coverlet/tree/main

This is the test project file from the repo - lib1.tests.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="coverlet.collector" Version="3.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>

I build using build.sh:

#!/bin/bash

mkdir out
dotnet publish ./lib1.tests -c Release -o out
cd out
dotnet test lib1.tests.dll --collect:"XPlat Code Coverage"

And this is the complete output:

/mnt/c/Work/coverlet$ ./build.sh
mkdir: cannot create directory ‘out’: File exists
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /mnt/c/Work/coverlet/lib1.tests/lib1.tests.csproj (in 351 ms).
  lib1.tests -> /mnt/c/Work/coverlet/lib1.tests/bin/Release/net5.0/lib1.tests.dll
  lib1.tests -> /mnt/c/Work/coverlet/out/
Microsoft (R) Test Execution Command Line Tool Version 16.8.3
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
'.ta collection : Unable to find a datacollector with friendly name 'XPlat Code Coverage
'ata collection : Could not find data collector 'XPlat Code Coverage
Testhost process exited with error: Unhandled exception. System.MissingMethodException: Method not found: 'Boolean Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers.CommandLineArgumentsHelper.TryGetIntArgFromDict(System.Collections.Generic.IDictionary`2<System.String,System.String>, System.String, Int32 ByRef)'.
   at Microsoft.VisualStudio.TestPlatform.TestHost.DefaultEngineInvoker.SetParentProcessExitCallback(IDictionary`2 argsDictionary)
   at Microsoft.VisualStudio.TestPlatform.TestHost.DefaultEngineInvoker.Invoke(IDictionary`2 argsDictionary)
   at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Run(String[] args)
   at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main(String[] args)
. Please check the diagnostic logs for more information.

Test Run Aborted.

I have the same behavior when running in powershell and WSL.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
MarcoRossignolicommented, Jan 15, 2021

I’m going to close this because it’s a dup follow this one https://github.com/coverlet-coverage/coverlet/issues/1042

1reaction
Malivilcommented, Jan 14, 2021

Sorry, I was focusing on that exception message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MissingMethodException Class (System)
MissingMethodException is thrown when code in a dependent assembly attempts to access a missing method in an assembly that was modified. MissingMethodException ......
Read more >
system missing method exception. why this happening
The method Activator.GetObject(Type, String) does not exist on .NET Core as you can see in the documentation for the Activator class.
Read more >
I'm having trouble connecting to our PI System and receiving a ...
I'm having trouble connecting to our PI System and receiving a Missing Method Exception when I try to initialize the PI System variable....
Read more >
ASP.NET Core - System.MissingMethodException is ...
I am trying to get DevExpress.AspNetCore.Dashboard version 17.2.3-ctp running with target framework net461. When I run the app, ...
Read more >
An exception of type 'System.MissingMethodException ...
An exception of type 'System.MissingMethodException' occurred in System.Collections.Concurrent.dll ... Often when I work on blog posts, I use the ...
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