Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

How to investigate skippedTo="MissingPdb"? #636

Closed
7 of 24 tasks
markvincze opened this issue Nov 4, 2016 · 12 comments
Closed
7 of 24 tasks

How to investigate skippedTo="MissingPdb"? #636

markvincze opened this issue Nov 4, 2016 · 12 comments

Comments

@markvincze
Copy link

Please provide the following information when submitting an issue, where appropriate replace the [ ] with a [X]

My Framework

  • .NET 2
  • .NET 3.5
  • .NET 4
  • .NET 4.5
  • .NET 4.6
  • .NET 4.6.1
  • .NET 4.6.2
  • .NET Core 1.0.0
  • Something else

My Environment

  • Windows 7 or below (not truly supported due to EOL)
  • Windows 8
  • Windows 8.1
  • Windows 10
  • Windows 10 IoT Core
  • Windows Server 2012
  • Windows Server 2012 R2
  • Windows Server 2016

I have already...

  • repeated the problem using the latest stable release of OpenCover.
  • reviewed the usage guide and usage document.
  • have looked at the opencover output xml file in an attempt to resolve the issue.
  • reviewed the current issues to check that the issue isn't already known.

My issue is related to (check only those which apply):

  • no coverage being recorded
  • 32 or 64 bit support
  • feature request

Expected Behavior

I have a simple .NET Core application with the following folder structure:

\-coverage-test
  \-src
    \-CoverageTest
  \-test
    \-CoverageTest.UnitTests

Where CoverageTest is just a simple Console application with a single public class, and CoverageTest.UnitTests implements a unit test for that class.

I build both the Console app and the unit test project using the framework net451.

I'm executing opencover and I'm expecting to get coverage results in the output xml.
The command I'm executing is the following.

path/to/OpenCover/OpenCover.Console.exe \
  -target:"C:\Program Files\dotnet\dotnet.exe" \
  -targetargs:"test -f net451 -c Release C:\Workspaces\Local\coverage-test\test\CoverageTest.UnitTests" \
  -searchdirs:"C:\Workspaces\Local\coverage-test\test\CoverageTest.UnitTests\bin\Release\net451\win7-x64" \
  -output:coverage/coverage.xml \
  -filter:"+[Coverage*]*" \
  -register:user

Actual Behavior

Instead of getting the coverage results, OpenCover.exe gives me the following output.

Executing: C:\Program Files\dotnet\dotnet.exe
Project CoverageTest (.NETFramework,Version=v4.5.1) was previously compiled. Skipping compilation.
Project CoverageTest.UnitTests (.NETFramework,Version=v4.5.1) was previously compiled. Skipping compilation.
xUnit.net .NET CLI test runner (64-bit Desktop .NET win10-x64)
  Discovering: CoverageTest.UnitTests
  Discovered:  CoverageTest.UnitTests
  Starting:    CoverageTest.UnitTests
Larger
  Finished:    CoverageTest.UnitTests
=== TEST EXECUTION SUMMARY ===
   CoverageTest.UnitTests  Total: 1, Errors: 0, Failed: 0, Skipped: 0, Time: 0.227s
Committing...
No results, this could be for a number of reasons. The most common reasons are:
    1) missing PDBs for the assemblies that match the filter please review the
    output file and refer to the Usage guide (Usage.rtf) about filters.
    2) the profiler may not be registered correctly, please refer to the Usage
    guide and the -register switch.

If I open the generated coverage.xml, I see a bunch of entries with all the various dependencies saying skippedDueTo="Filter" (as it is expected), and I also see my assembly saying `skippedDueTo="MissingPdb".

<Module skippedDueTo="MissingPdb" hash="92-CC-38-F3-C3-4F-75-79-A3-51-87-9A-22-A8-CB-07-C6-00-7E-99">
  <ModulePath>C:\Workspaces\Local\coverage-test\test\CoverageTest.UnitTests\bin\Release\net451\win7-x64\CoverageTest.exe</ModulePath>
  <ModuleTime>2016-11-04T09:06:36.0545889Z</ModuleTime>
  <ModuleName>CoverageTest</ModuleName>
  <Classes />
</Module>

If I open the folder I specified in the searchdirs argument (I made sure it's the same path by copy-pasting it), I can see that the folder contains both the exe and the pdb files for my assembly, so that seems to be correct.

image

Steps to reproduce the problem:

If you could give me some generic pointers about what can cause this problem, I'm happy to investigate more, or I can upload the self-contained example reproducing the problem to Github.

@sawilde
Copy link
Member

sawilde commented Nov 4, 2016

We currently have issue with supporting .NET core - we are awaiting a 3rd party library to be updated to be production ready before we attempt to support it.

@markvincze
Copy link
Author

@sawilde I've seen it work though, it's set up in the Google Cloud Platform SDK (this is the script executing it: https://github.com/GoogleCloudPlatform/google-cloud-dotnet/blob/master/build.sh), and I tried to replicate it in my own project, but then received the MissingPdb error.
I'll try to investigate more to see what's the difference between my project and the google-cloud-dotnet.

@markvincze
Copy link
Author

@sawilde With some more experimentation I managed to get it working.

The only thing causing the problem was the buildOptions part in the project.json (this was generated by default using dotnet new):

  "buildOptions": {
    "debugType": "portable"
  },

I had to remove the "debugType": "portable" line, and now the coverage is properly calculated.
It works both with the net415 or the netcoreapp1.0 framework.

@sawilde
Copy link
Member

sawilde commented Nov 6, 2016

Ah yes portable PDBs - we don't handle them yet - we use a 3rd party library to provide PDB support and that is still in beta.

I decided a long time ago to not use beta packages in OpenCover as it causes more problems and support issues and I don't have the time to deal with them.

@sawilde sawilde closed this as completed Nov 14, 2016
@m4ss1m0g
Copy link

Same issue with VS2017 where "debugType": "portable" is defalt

Add this lines to .csproj

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DebugType>full</DebugType>
    <DebugSymbols>True</DebugSymbols>
  </PropertyGroup>

Alternative go to Project Properties -> Build on Output Section click advanced and select Debugging Information Full

@sawilde
Copy link
Member

sawilde commented Apr 20, 2017

@m4ss1m0g we do have a wip build of OpenCover that supports PDBs - #601

@faridmasood
Copy link

Very Silly.
I eated up half of the internet and the problem was
DebugType>full</DebugType>

@sc1ent
Copy link

sc1ent commented Jul 4, 2018

Also please note that you have that it set to Full in the appropriate release configuration. I ran into the issue where it was set to Full for Debug but we were seeing this issue on our build server as it was building Release. Below is how your .csproj file should look to ensure you have the PDBs generating for both configurations.

full true full true

@pnlakshman
Copy link

Hi Sawilde,
i am also facing the same problem of Missing PDB files. I do not have write to share the code but i can explain the situation.

Environment:
.Net Framework 4.5.1
Visual Studio 2017
Name space used to write test class: Microsoft.VisualStudio.TestTools.UnitTesting
Test frame assuming: MSTest
When try to generate coverage report using Opencover it is trowing Missing PDB files error.

i been trying last one week, Please help me on this.

Thank You,
Lakshman.

@sawilde
Copy link
Member

sawilde commented Jul 19, 2019

  1. Do you have PDB files and are they full PDBs?
  2. Are they on the folder where the code is running? MSTest often copies assemblies to new locations to execute them which can cause issues - you can control this with switches passed to MSTest

@pnlakshman
Copy link

Hi Sawilde,

Thank you so much for your response. I have PDB files and they are full PDBs. Is it possible to copy manually PDB files? If so, would you please suggest me the location where MSTest copies assemblies? or one example, how can we control this with switches?

Thanks & Regards,
Lakshman.

@sawilde
Copy link
Member

sawilde commented Jul 26, 2019

you should look at mstest switches - I think the one you are looking for is /noisolation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants