Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/coverlet.core/Instrumentation/Instrumenter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -91,6 +90,13 @@ private void InstrumentType(TypeDefinition type)
if (!actualMethod.CustomAttributes.Any(IsExcludeAttribute))
InstrumentMethod(method);
}

var ctors = type.GetConstructors();
foreach (var ctor in ctors)
{
if (!ctor.CustomAttributes.Any(IsExcludeAttribute))
InstrumentMethod(ctor);
}
}

private void InstrumentMethod(MethodDefinition method)
Expand Down Expand Up @@ -167,7 +173,7 @@ private void InstrumentIL(MethodDefinition method)
private Instruction AddInstrumentationCode(MethodDefinition method, ILProcessor processor, Instruction instruction, SequencePoint sequencePoint)
{
if (!_result.Documents.TryGetValue(sequencePoint.Document.Url, out var document))
{
{
document = new Document { Path = sequencePoint.Document.Url };
_result.Documents.Add(document.Path, document);
}
Expand All @@ -194,7 +200,7 @@ private Instruction AddInstrumentationCode(MethodDefinition method, ILProcessor
private Instruction AddInstrumentationCode(MethodDefinition method, ILProcessor processor, Instruction instruction, BranchPoint branchPoint)
{
if (!_result.Documents.TryGetValue(branchPoint.Document, out var document))
{
{
document = new Document { Path = branchPoint.Document };
_result.Documents.Add(document.Path, document);
}
Expand Down