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

OpenCover fails to handle multiple PDBs #800

@sharwell

Description

@sharwell

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 build which produces portable PDBs, which are not supported by OpenCover 4.6.519. To work around this limitation, I used pdb2pdb to convert the portable PDBs to Windows PDBs, and then used the -searchdirs flag to pass the directory containing the converted files to OpenCover.

I expected OpenCover to locate the converted Windows PDBs and use them during the coverage analysis.

Actual Behavior

OpenCover reports that the PDBs for the assemblies using portable PDBs during the build are missing. Deleting the portable PDBs (after conversion to Windows PDBs, but before running OpenCover) appears to resolve the problem. As best I can tell, OpenCover only tries once to locate the PDB; if the file is found with the expected name but fails to load, it does not continue looking in searchdirs paths for other files which may successfully load.

On further investigation, it appears that a PDB in searchdirs is only considered if the original assembly appears in the same directory. This doesn't work well for relocated PDBs. In all I needed to apply the following workarounds:

  1. During PDB conversion, I had to copy the original assembly to the temporary directory containing PDBs.
  2. I had to delete the original portable PDBs or the converted PDBs were never checked.

Steps to reproduce the problem:

DotNetAnalyzers/StyleCopAnalyzers#2627

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions