Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCover Reports missing pdbs when pdbs are present (XUnit/.NET Core)

I'm using OpenCover to generate test coverage reports for my projects, but it's not generating any data. Checking in my logs, it's showing "missing pdb" for the dlls in question, however the pdbs are available in the same directory.

Things I've tried:

  1. I've tried adding the directories with the pdbs in explicitly using the -searchdirs option - makes no difference.
  2. I've checked and it looks like XUnit doesn't do shadow copying of dlls, so they are being accessed from the right directory. The opencover results.xml backs me up on this.

I'm using a command line of

opencover.console -oldstyle -register:user 
                  -target:"C:\Program Files\Dotnet\dotnet.exe" 
                  -targetargs:"test" 
                  -searchdirs:"C:\dev\public\hermes-c#\Hermes.Server\Hermes.AspNetCore.Test\bin\Debug\netcoreapp1.0"

Any and all thoughts appreciated!

like image 638
Richard Matheson Avatar asked Dec 29 '16 17:12

Richard Matheson


1 Answers

.NET Core uses a "Portable PDB" format by default, which OpenCover does not understand yet.

Try the following build options instead:

"buildOptions": {
  "debugType": "full"
},

Note: when using full the generated debug symbols are for Windows only...

Update: with MSBuild based projects this becomes:

<PropertyGroup>
  <DebugType>full</DebugType>
</PropertyGroup>

And, we're able to build using the /p:DebugType=Full switch too. Thus, the "ordinary" build can use the default debug setting, but a "special" build for coverage analysis can change that to full.

like image 127
Axel Heer Avatar answered Dec 02 '22 07:12

Axel Heer