From b8db97bfb320243db81357feefd5e8b67ea2c928 Mon Sep 17 00:00:00 2001 From: Toni Solarin-Sodara Date: Sat, 8 Dec 2018 19:17:05 +0100 Subject: [PATCH] add support for instrumenting assemblies with embedded pdbs --- src/coverlet.core/Helpers/InstrumentationHelper.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/coverlet.core/Helpers/InstrumentationHelper.cs b/src/coverlet.core/Helpers/InstrumentationHelper.cs index 426b76c..4d3e300 100644 --- a/src/coverlet.core/Helpers/InstrumentationHelper.cs +++ b/src/coverlet.core/Helpers/InstrumentationHelper.cs @@ -69,8 +69,13 @@ namespace Coverlet.Core.Helpers if (entry.Type == DebugDirectoryEntryType.CodeView) { var codeViewData = peReader.ReadCodeViewDebugDirectoryData(entry); - var peDirectory = Path.GetDirectoryName(module); - return File.Exists(Path.Combine(peDirectory, Path.GetFileName(codeViewData.Path))); + if (codeViewData.Path == $"{Path.GetFileNameWithoutExtension(module)}.pdb") + { + // PDB is embedded + return true; + } + + return File.Exists(codeViewData.Path); } }