Coverlet is unable to instrument any modules for my test project

1.8k views Asked by At

When running this command (using coverlet underneath):

dotnet test /p:CollectCoverage=true .\My.Test.Solution.sln

(also tried other variations including coverlet itself)

I'm getting a lot of warnings like this one:

warning : [coverlet] 
Unable to instrument module: C:\[bin_root_path]\bin\ApplicationLogAnalyzer.dll because: 
Symbols were found but are not matching the assembly
C:\[repo_path]\My.Project.Tests\My.Project.Tests.csproj]

And later on also this:

warning : [coverlet] BadImageFormatException during MetadataReaderProvider.FromPortablePdbStream in
InstrumentationHelper.PortablePdbHasLocalSource, unable to check if module has got local source. 
C:\[repo_path]\My.Project.Tests\My.Project.Tests.csproj]

All of the involved dll files are not being used by my test project, it seems a side effect of how the build is set up. All dlls (and related) are placed in the same bin folder. (I've heard that being called a deterministic build)

I've tried isolating my test project and it's related business project into a separate solution to see if coverlet works there and it does.

In the beginning of the test log I'm getting this:

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  My.Project.Tests -> C:\[bin_root_path]\bin\My.Project.Tests.dll
C:\Program Files\dotnet\sdk\6.0.201\Microsoft.Common.CurrentVersion.targets(4808,5): 
warning MSB3026: 
Could not copy "C:\Users\[my_user]\.nuget\packages\microsoft.testplatform.objectmodel\16.11.0\lib\netcoreapp2.1\Microsoft.TestPlatform.PlatformAbstractions.dll" to "..\
bin_root_path]\bin\Microsoft.TestPlatform.PlatformAbstractions.dll".
Beginning retry 1 in 1000ms. The process cannot access the file
'C:\[bin_root_path]\bin\Microsoft.TestPlatform.PlatformAbstractions.dll'
because it is being used by another process.  

Could this be causing the previous warnings somehow or is that unrelated? I've tried deleting all of those TestPlatform files in my bin folder but no difference. They come back and the log still shows the being used error.

The command does result in a list of coverages but it excludes my test project.

Any ideas on how to solve this issue?

0

There are 0 answers