@@ -157,10 +157,17 @@ public static void PrintIL(this IDelegateDebugInfo diagInfo, [CallerMemberName]
157157 SmallMap4 < IDelegateDebugInfo , string , RefEq < IDelegateDebugInfo > ,
158158 SmallMap4 . SingleArrayEntries < IDelegateDebugInfo , string , RefEq < IDelegateDebugInfo > >
159159 > uniquePrinted = default ;
160- PrintIL ( diagInfo , ref uniquePrinted , tag ) ;
160+ var totalNestedCount = 0 ;
161+ PrintIL ( diagInfo , ref totalNestedCount , ref uniquePrinted , tag ) ;
162+ if ( totalNestedCount > 0 )
163+ {
164+ Console . WriteLine ( "--------------------------------------" ) ;
165+ Console . WriteLine ( $ "Total nested lambdas: { totalNestedCount } , unique printed: { uniquePrinted . Count } ") ;
166+ }
161167 }
162168
163169 private static void PrintIL ( this IDelegateDebugInfo diagInfo ,
170+ ref int totalNestedCount ,
164171 ref SmallMap4 < IDelegateDebugInfo , string , RefEq < IDelegateDebugInfo > ,
165172 SmallMap4 . SingleArrayEntries < IDelegateDebugInfo , string , RefEq < IDelegateDebugInfo > > > uniquePrinted ,
166173 [ CallerMemberName ] string tag = null )
@@ -176,9 +183,10 @@ private static void PrintIL(this IDelegateDebugInfo diagInfo,
176183 else
177184 {
178185 printedTag = $ "{ n } _{ tag } ";
179- PrintIL ( nested , ref uniquePrinted , printedTag ) ;
186+ PrintIL ( nested , ref totalNestedCount , ref uniquePrinted , printedTag ) ;
180187 }
181188 ++ n ;
189+ ++ totalNestedCount ;
182190 }
183191 }
184192
0 commit comments