Improve recursive call analysis for ref parameters#315
Merged
SergeyTeplyakov merged 1 commit intomasterfrom Jul 30, 2025
Merged
Improve recursive call analysis for ref parameters#315SergeyTeplyakov merged 1 commit intomasterfrom
SergeyTeplyakov merged 1 commit intomasterfrom
Conversation
Enhances RecursiveCallAnalyzer to avoid false positives when ref parameters are modified or passed to other methods before recursive calls. Adds logic to distinguish calls on different instances and updates tests to cover these scenarios. Plus downgraded the compiler packages because they cause issues when adopting them.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the RecursiveCallAnalyzer to reduce false positives by improving detection of legitimate recursive calls. The analyzer now distinguishes between calls on different instances and tracks when ref parameters are modified before recursive calls.
- Added logic to detect when ref parameters are "touched" (modified or passed to other methods) before recursive calls
- Implemented instance tracking to differentiate between calls on the same instance vs different instances
- Downgraded Microsoft CodeAnalysis packages from 4.14.0 to 4.13.0 to resolve adoption issues
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| RecursiveCallAnalyzer.cs | Enhanced with ref parameter tracking and instance differentiation logic |
| RecursiveCallAnalyzerTests.cs | Added comprehensive test cases for new analyzer scenarios |
| Directory.Packages.props | Downgraded Microsoft CodeAnalysis package versions |
Comments suppressed due to low confidence (1)
src/ErrorProne.NET.CoreAnalyzers/RecursiveCallAnalyzer.cs:10
- The version 0.8.0-beta.1 for ErrorProne.NET.CoreAnalyzers appears to be upgrading from 0.6.1-beta.1, which contradicts the PR description stating packages were downgraded. Please verify this version exists and is intended.
[DiagnosticAnalyzer(LanguageNames.CSharp)]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhances RecursiveCallAnalyzer to avoid false positives when ref parameters are modified or passed to other methods before recursive calls. Adds logic to distinguish calls on different instances and updates tests to cover these scenarios.
Plus downgraded the compiler packages because they cause issues when adopting them.