Skip to content

Commit f08506e

Browse files
authored
Merge pull request #367 from ViceIce/fix/invalid-pdb
fix: catch exception
2 parents 6fec36d + 59a4704 commit f08506e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/coverlet.core/Instrumentation/Instrumenter.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ public Instrumenter(string module, string identifier, string[] excludeFilters, s
5050
_logger = logger;
5151
}
5252

53-
public bool CanInstrument() => InstrumentationHelper.HasPdb(_module);
53+
public bool CanInstrument()
54+
{
55+
try
56+
{
57+
return InstrumentationHelper.HasPdb(_module);
58+
}
59+
catch (Exception ex)
60+
{
61+
_logger.LogWarning($"Unable to instrument module: '{_module}' because : {ex.Message}");
62+
return false;
63+
}
64+
}
5465

5566
public InstrumenterResult Instrument()
5667
{
@@ -602,4 +613,4 @@ public MethodReference ImportReference(MethodReference method, IGenericParameter
602613
}
603614
}
604615
}
605-
}
616+
}

0 commit comments

Comments
 (0)