Skip to content

Commit

Permalink
Fix instrumenting extra assemblies
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslorentz committed Mar 1, 2018
1 parent 9535f91 commit 111097f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/MiniCover/Instrumentation/Instrumenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ private InstrumentedAssembly InstrumentAssemblyIfNecessary(string assemblyFile)

foreach (var documentGroup in documentsGroups)
{
var sourceRelativePath = GetSourceRelativePath(documentGroup.Key.Url);
if (sourceRelativePath == null)
if (!sourceFiles.Contains(documentGroup.Key.Url))
continue;

var sourceRelativePath = GetSourceRelativePath(documentGroup.Key.Url);

if (documentGroup.Key.FileHasChanged())
{
Console.WriteLine($"Ignoring modified file \"{documentGroup.Key.Url}\"");
Expand Down Expand Up @@ -239,7 +240,7 @@ private bool HasSourceFiles(AssemblyDefinition assemblyDefinition)
.SelectMany(m => m.DebugInformation.SequencePoints)
.Select(s => s.Document.Url)
.Distinct()
.Any(d => GetSourceRelativePath(d) != null);
.Any(d => sourceFiles.Contains(d));
}

private void RestoreBackup(string assemblyFile)
Expand Down Expand Up @@ -335,15 +336,15 @@ private string GetSourceRelativePath(string path)
{
Uri file = new Uri(path);
Uri folder = new Uri(normalizedWorkDir);
string relativePath =
string relativePath =
Uri.UnescapeDataString(
folder.MakeRelativeUri(file)
.ToString()
.Replace('/', Path.DirectorySeparatorChar)
);
return relativePath;
return relativePath;
}

private string GetPdbFile(string assemblyFile)
{
return Path.ChangeExtension(assemblyFile, "pdb");
Expand Down

0 comments on commit 111097f

Please sign in to comment.