[coverlet] Unable to instrument module - NET 5 - Microsoft.Extensions.Logging.Abstractions
See original GitHub issueFor 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
todotnet 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:
- https://github.com/coverlet-coverage/coverlet/issues/1098 (but I can’t use preview packages),
- https://github.com/coverlet-coverage/coverlet/issues/1221 (no solution yet)
- https://github.com/coverlet-coverage/coverlet/issues/1102 (copy to publish not possible for us)
- probably more issues
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:
- Created 2 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s a ASP.NET Core 5 application with multiple projects.
I’m afraid it will take some time to create a repro.
Hi @304NotModified thanks for reporting this. We’ll take a look asap.