1
1
using System ;
2
- using System . Collections . Generic ;
3
2
using System . Diagnostics . CodeAnalysis ;
4
3
using System . IO ;
5
4
using System . Linq ;
@@ -91,6 +90,17 @@ private void InstrumentType(TypeDefinition type)
91
90
if ( ! actualMethod . CustomAttributes . Any ( IsExcludeAttribute ) )
92
91
InstrumentMethod ( method ) ;
93
92
}
93
+
94
+ var ctors = type . GetConstructors ( ) ;
95
+ foreach ( var ctor in ctors )
96
+ {
97
+ MethodDefinition actualMethod = ctor ;
98
+ if ( InstrumentationHelper . IsLocalMethod ( ctor . Name ) )
99
+ actualMethod = methods . FirstOrDefault ( m => m . Name == ctor . Name . Split ( '>' ) [ 0 ] . Substring ( 1 ) ) ?? ctor ;
100
+
101
+ if ( ! actualMethod . CustomAttributes . Any ( IsExcludeAttribute ) )
102
+ InstrumentMethod ( ctor ) ;
103
+ }
94
104
}
95
105
96
106
private void InstrumentMethod ( MethodDefinition method )
@@ -167,7 +177,7 @@ private void InstrumentIL(MethodDefinition method)
167
177
private Instruction AddInstrumentationCode ( MethodDefinition method , ILProcessor processor , Instruction instruction , SequencePoint sequencePoint )
168
178
{
169
179
if ( ! _result . Documents . TryGetValue ( sequencePoint . Document . Url , out var document ) )
170
- {
180
+ {
171
181
document = new Document { Path = sequencePoint . Document . Url } ;
172
182
_result . Documents . Add ( document . Path , document ) ;
173
183
}
@@ -194,7 +204,7 @@ private Instruction AddInstrumentationCode(MethodDefinition method, ILProcessor
194
204
private Instruction AddInstrumentationCode ( MethodDefinition method , ILProcessor processor , Instruction instruction , BranchPoint branchPoint )
195
205
{
196
206
if ( ! _result . Documents . TryGetValue ( branchPoint . Document , out var document ) )
197
- {
207
+ {
198
208
document = new Document { Path = branchPoint . Document } ;
199
209
_result . Documents . Add ( document . Path , document ) ;
200
210
}
0 commit comments