Skip to content

Commit 4ead796

Browse files
authored
Merge pull request #259 from tonerdo/embedded-pdbs
Add support for assemblies with embedded PDBs
2 parents b4d35a5 + 553d201 commit 4ead796

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</Target>
2626

2727
<Target Name="RunTests" AfterTargets="CopyMSBuildScripts">
28-
<Exec Command="dotnet test &quot;$(MSBuildThisFileDirectory)test\coverlet.core.tests\coverlet.core.tests.csproj&quot; -c $(Configuration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover"/>
28+
<Exec Command="dotnet test &quot;$(MSBuildThisFileDirectory)test\coverlet.core.tests\coverlet.core.tests.csproj&quot; -c $(Configuration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include=[coverlet.*]*"/>
2929
</Target>
3030

3131
<Target Name="CreateNuGetPackage" AfterTargets="RunTests" Condition="$(Configuration) == 'Release'">

src/coverlet.core/Helpers/InstrumentationHelper.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ public static bool HasPdb(string module)
6969
if (entry.Type == DebugDirectoryEntryType.CodeView)
7070
{
7171
var codeViewData = peReader.ReadCodeViewDebugDirectoryData(entry);
72-
var peDirectory = Path.GetDirectoryName(module);
73-
return File.Exists(Path.Combine(peDirectory, Path.GetFileName(codeViewData.Path)));
72+
if (codeViewData.Path == $"{Path.GetFileNameWithoutExtension(module)}.pdb")
73+
{
74+
// PDB is embedded
75+
return true;
76+
}
77+
78+
return File.Exists(codeViewData.Path);
7479
}
7580
}
7681

0 commit comments

Comments
 (0)