You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
This seems to be a known issue.
When I run the following command:
It displays the following warning and the coverage is zero. It seems that it cannot load the dll containing my code.
I tried add
<PreserveCompilationContext>true</PreserveCompilationContext>
to .csproj file. I can see that theMicrosoft.Extensions.Logging.Abstractions.dll
is copied to therefs
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.
The text was updated successfully, but these errors were encountered: