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

Troubleshooting "Cannot instrument assembly"

Michael Freidgeim edited this page Jul 6, 2017 · 2 revisions

When executing OpenCover you may see the warning
Cannot instrument FullpassToYours.dll as no PDB/MDB could be loaded.

If the same message will be shown for all DLLs, summary message shows some possible reasons for it.

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

However for VS2017 project the reason could be a new 'portable' format of PDB, which can be the default for some types of new projects. If your target is .net core, you need to wait for implementation of https://github.com/OpenCover/opencover/issues/610. But if your target is full .Net framework, you can just change the PDB format in the project properties from Portable PDB to Full PDB.

Just add to .csproj

 <PropertyGroup >
     <DebugType>full</DebugType>
     <DebugSymbols>True</DebugSymbols>
  </PropertyGroup>

And OpenCover will be able to instrument your projects.

Alternatively you can use Visual Studio to open Project Properties->Build ->Advanced->Output->Debugging Information change to Full from Portable. However It will add to csproj file setting with specific build condition, e.g.

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

Normally you want to apply it for all options, so you will need to edit csproj file anyway to remove the condition.