-
Notifications
You must be signed in to change notification settings - Fork 392
Closed
Labels
untriagedTo be investigatedTo be investigated
Description
This seems to be a known issue.
When I run the following command:
dotnet test /p:CollectCoverage=true
It displays the following warning and the coverage is zero. It seems that it cannot load the dll containing my code.
/var/nuget/coverlet.msbuild/3.0.3/build/coverlet.msbuild.targets(39,5): warning : [coverlet] Unable to instrument module: /home/codespace/workspace/OwnHub/OwnHub.Tests/bin/Debug/net5.0/OwnHub.dll because : AssemblyResolutionException for 'Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Try to add <PreserveCompilationContext>true</PreserveCompilationContext> to test projects </PropertyGroup> or pass '/p:CopyLocalLockFileAssemblies=true' option to the 'dotnet test' command-line [/home/codespace/workspace/OwnHub/OwnHub.Tests/OwnHub.Tests.csproj]
I tried add <PreserveCompilationContext>true</PreserveCompilationContext> to .csproj file. I can see that the Microsoft.Extensions.Logging.Abstractions.dll is copied to the refs folder in the output path, but the test still doesn't work.
I tried manually copy the Microsoft.Extensions.Logging.Abstractions.dll to the output directory and retesting the coverage showed up fine.
Since I see in the documentation of known issues that this issue should not happen for .NET runtime version >= 3.0, I'm wondering if this is the expected case.
pavelpykhtin and EYHN
Metadata
Metadata
Assignees
Labels
untriagedTo be investigatedTo be investigated