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