Skip to content

Commit a1f18b4

Browse files
committed
improve checking of compiler generated types
1 parent 017b3d9 commit a1f18b4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/coverlet.core/Instrumentation/Instrumenter.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,9 @@ private void InstrumentModule()
6666
using (var module = ModuleDefinition.ReadModule(stream, parameters))
6767
{
6868
var types = module.GetTypes();
69-
foreach (var type in types)
69+
foreach (TypeDefinition type in types)
7070
{
71-
TypeDefinition actualType = type;
72-
if (type.FullName.Contains("/"))
73-
actualType = types.FirstOrDefault(t => t.FullName == type.FullName.Split('/')[0]);
74-
71+
var actualType = type.DeclaringType ?? type;
7572
if (!actualType.CustomAttributes.Any(IsExcludeAttribute)
7673
&& !InstrumentationHelper.IsTypeExcluded(_module, actualType.FullName, _filters))
7774
InstrumentType(type);

0 commit comments

Comments
 (0)