File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/coverlet.core/Instrumentation Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,8 @@ private void InstrumentModule()
70
70
{
71
71
resolver . AddSearchDirectory ( Path . GetDirectoryName ( _module ) ) ;
72
72
var parameters = new ReaderParameters { ReadSymbols = true , AssemblyResolver = resolver } ;
73
- if ( Path . GetFileNameWithoutExtension ( _module ) == "System.Private.CoreLib" )
73
+ bool isCoreLib = Path . GetFileNameWithoutExtension ( _module ) == "System.Private.CoreLib" ;
74
+ if ( isCoreLib )
74
75
{
75
76
parameters . MetadataImporterProvider = new CoreLibMetadataImporterProvider ( ) ;
76
77
}
@@ -91,6 +92,8 @@ private void InstrumentModule()
91
92
{
92
93
var actualType = type . DeclaringType ?? type ;
93
94
if ( ! actualType . CustomAttributes . Any ( IsExcludeAttribute )
95
+ // Instrumenting Interlocked which is used for recording hits would cause an infinite loop.
96
+ && ( ! isCoreLib || actualType . FullName != "System.Threading.Interlocked" )
94
97
&& ! InstrumentationHelper . IsTypeExcluded ( _module , actualType . FullName , _excludeFilters )
95
98
&& InstrumentationHelper . IsTypeIncluded ( _module , actualType . FullName , _includeFilters ) )
96
99
InstrumentType ( type ) ;
You can’t perform that action at this time.
0 commit comments