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()
7070 {
7171 resolver . AddSearchDirectory ( Path . GetDirectoryName ( _module ) ) ;
7272 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 )
7475 {
7576 parameters . MetadataImporterProvider = new CoreLibMetadataImporterProvider ( ) ;
7677 }
@@ -91,6 +92,8 @@ private void InstrumentModule()
9192 {
9293 var actualType = type . DeclaringType ?? type ;
9394 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" )
9497 && ! InstrumentationHelper . IsTypeExcluded ( _module , actualType . FullName , _excludeFilters )
9598 && InstrumentationHelper . IsTypeIncluded ( _module , actualType . FullName , _includeFilters ) )
9699 InstrumentType ( type ) ;
You can’t perform that action at this time.
0 commit comments