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.

[coverlet] Unable to instrument module - NET 5 - Microsoft.Extensions.Logging.Abstractions

See original GitHub issue

For some test projects, but not all, we get

/home/AzDevOps/.nuget/packages/coverlet.msbuild/3.1.0/build/coverlet.msbuild.targets(39,5): warning : [coverlet] Unable to instrument module: MyApi.dll because : AssemblyResolutionException for ‘Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’. Try to add <PreserveCompilationContext></PreserveCompilationContext> to test projects </PropertyGroup> or pass '/p:CopyLocalLockFileAssemblies=’ option to the ‘dotnet test’ command-line

Tried:

  • Adding <PreserveCompilationContext>true</PreserveCompilationContext> to csprojs
  • Also pass /p:CopyLocalLockFileAssemblies=true to dotnet test
  • Included a package reference to Microsoft.Extensions.Logging.Abstractions directly in the test projects.
  • upgrade coverlet from 3.0.3 to 3.1.0

Related:

PS I hope this helps to diagnose the issue https://github.com/coverlet-coverage/coverlet/issues/1196. I have run more than 10 builds (with 10 tries), but all have the same issue 😦

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
304NotModifiedcommented, Oct 28, 2021

It’s a ASP.NET Core 5 application with multiple projects.

I’m afraid it will take some time to create a repro.

2reactions
MarcoRossignolicommented, Oct 6, 2021

Hi @304NotModified thanks for reporting this. We’ll take a look asap.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - [coverlet] Unable to instrument module - NET 5
Extensions.Logging.Abstractions directly in the test projects. upgrade coverlet from 3.0.3 to 3.1.0. Related: https://github.com/coverlet- ...
Read more >
Coverlet is unable to instrument any modules for my test ...
When running this command (using coverlet underneath): dotnet test /p:CollectCoverage=true .\My.Test.Solution.sln.
Read more >
Windows 10 .Net 6 or .Net 7 runtime getting error Could not ...
Windows 10 .Net 6 or .Net 7 runtime getting error Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0.
Read more >
coverlet
Coverlet is a cross platform code coverage framework for .NET, with support for line, branch and method coverage. It works with .NET Framework...
Read more >
Tools 2021 | A Programmer with Microsoft tools
“Unable to provide System.CommandLine tab completion support unless the [dotnet-suggest] tool is first installed.” “See the following for tool ...
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