File tree Expand file tree Collapse file tree
src/ThrowsAnalyzer/Analysis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,11 +35,14 @@ public async Task<ExceptionFlowInfo> AnalyzeMethodAsync(IMethodSymbol method)
3535
3636 var flowInfo = new ExceptionFlowInfo ( method ) ;
3737
38+ // Add placeholder to cache immediately to prevent infinite recursion
39+ // in case of circular method calls
40+ _cache [ method ] = flowInfo ;
41+
3842 // Find the method's syntax node
3943 var syntaxReferences = method . DeclaringSyntaxReferences ;
4044 if ( ! syntaxReferences . Any ( ) )
4145 {
42- _cache [ method ] = flowInfo ;
4346 return flowInfo ;
4447 }
4548
@@ -59,9 +62,6 @@ public async Task<ExceptionFlowInfo> AnalyzeMethodAsync(IMethodSymbol method)
5962 // 4. Calculate propagated exceptions (thrown - caught)
6063 CalculatePropagatedExceptions ( flowInfo , semanticModel ) ;
6164
62- // Cache the result
63- _cache [ method ] = flowInfo ;
64-
6565 return flowInfo ;
6666 }
6767
You can’t perform that action at this time.
0 commit comments