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.

The type initializer for 'Coverlet.Core.Instrumentation.NetstandardAwareAssemblyResolver' threw an exception

See original GitHub issue

Recently migrated to a new machine where I cannot seem to get code coverage tools working.

OS: Mac OS Platform: .NET Core

% dotnet --version
3.1.401

Test output:

% dotnet test path /p:CollectCoverage=true
Build succeeded.

       "/Users/hkj/Projects/firebase-admin-dotnet/public/FirebaseAdmin/FirebaseAdmin.Tests/FirebaseAdmin.Tests.csproj" (VSTest target) (1:7) ->
       (InstrumentModulesAfterBuild target) -> 
         /Users/hkj/.nuget/packages/coverlet.msbuild/2.6.3/build/coverlet.msbuild.targets(24,5): warning : [coverlet] Unable to instrument module: /Users/hkj/Projects/firebase-admin-dotnet/public/FirebaseAdmin/FirebaseAdmin.Tests/bin/Debug/netcoreapp2.0/FirebaseAdmin.dll because : The type initializer for 'Coverlet.Core.Instrumentation.NetstandardAwareAssemblyResolver' threw an exception. [/Users/hkj/Projects/firebase-admin-dotnet/public/FirebaseAdmin/FirebaseAdmin.Tests/FirebaseAdmin.Tests.csproj]

    1 Warning(s)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
MarcoRossignolicommented, Sep 9, 2020

Ok use last version 2.6.3 is pretty old 7/1/2019

Feel free to close if solved.

0reactions
hiranya911commented, Sep 8, 2020

With v2.9.0 of the coverlet.msbuild package I seem to get a successful build (on .NET 3.1).

1:7>Target "GenerateCoverageResultAfterTest" in file "/Users/hkj/.nuget/packages/coverlet.msbuild/2.9.0/build/coverlet.msbuild.targets" from project "/Users/hkj/Projects/firebase-admin-dotnet/public/FirebaseAdmin/FirebaseAdmin.Tests/FirebaseAdmin.Tests.csproj" (entry point):
   1:7>Done building target "GenerateCoverageResultAfterTest" in project "FirebaseAdmin.Tests.csproj".
   1:7>Done Building Project "/Users/hkj/Projects/firebase-admin-dotnet/public/FirebaseAdmin/FirebaseAdmin.Tests/FirebaseAdmin.Tests.csproj" (VSTest target(s)).

Build succeeded.

So this may be an issue with v2.6.0 on new version of .NET Core.

I’m running a pretty standard installation.

% dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.401
 Commit:    39d17847db

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.15
 OS Platform: Darwin
 RID:         osx.10.15-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.1.401/

Host (useful for support):
  Version: 3.1.7
  Commit:  fcfdef8d6b

.NET Core SDKs installed:
  2.1.809 [/usr/local/share/dotnet/sdk]
  3.1.401 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
Read more comments on GitHub >

github_iconTop Results From Across the Web

coverlet: Unable to instrument module (ArgumentException)
I faced an issue when some projects from solution (NOT ALL) are not being instrumented (have zero coverage, though have active unit tests)....
Read more >
SOLVED the type initializer for module threw an exception ...
this error the type initializer for module threw an exception happened, when you installed upper version of .net framework. to solve this ...
Read more >
Exception trying to instrument a .NET Framework assembly ...
In a .NET Framework project using a type from the System.Data.SqlClient namespace, coverlet attempts to instrument an assembly with that name. That fails...
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