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 @@ -71,7 +71,8 @@ private void InstrumentModule()
71
71
{
72
72
resolver . AddSearchDirectory ( Path . GetDirectoryName ( _module ) ) ;
73
73
var parameters = new ReaderParameters { ReadSymbols = true , AssemblyResolver = resolver } ;
74
- if ( Path . GetFileNameWithoutExtension ( _module ) == "System.Private.CoreLib" )
74
+ bool isCoreLib = Path . GetFileNameWithoutExtension ( _module ) == "System.Private.CoreLib" ;
75
+ if ( isCoreLib )
75
76
{
76
77
parameters . MetadataImporterProvider = new CoreLibMetadataImporterProvider ( ) ;
77
78
}
@@ -92,6 +93,8 @@ private void InstrumentModule()
92
93
{
93
94
var actualType = type . DeclaringType ?? type ;
94
95
if ( ! actualType . CustomAttributes . Any ( IsExcludeAttribute )
96
+ // Instrumenting Interlocked which is used for recording hits would cause an infinite loop.
97
+ && ( ! isCoreLib || actualType . FullName != "System.Threading.Interlocked" )
95
98
&& ! InstrumentationHelper . IsTypeExcluded ( _module , actualType . FullName , _excludeFilters )
96
99
&& InstrumentationHelper . IsTypeIncluded ( _module , actualType . FullName , _includeFilters ) )
97
100
InstrumentType ( type ) ;
You can’t perform that action at this time.
0 commit comments