Hello,
We are using SonarCloud (Team plan) and the AI Code Fix feature for C#. We’ve encountered an inconsistency with the rule csharpsquid:S2259 – “Null pointers should not be dereferenced”.
According to the official documentation, this rule is supported by AI Code Fix. However, we’ve found that some issues for this rule successfully generate an AI fix, while others do not, even though they are in the same project and branch.
For example:
-
Case where AI Fix works correctly: the button “Generate Fix” returns a valid suggestion. -
Case where it fails: the same button displays the message“Something went wrong. We are not able to generate a fix for this issue.”
We have verified:
-
The project uses a Quality Gate qualified for AI Code Assurance.
-
The rule
S2259is officially listed as supported. -
AI Code Fix works fine for other issues in the same project.
Could you please help us understand:
-
Why some
S2259issues are not eligible for AI Code Fix even though the rule is supported? -
Is this expected behavior (for instance, due to contextual complexity or confidence thresholds)?
-
Is there any additional configuration we should review in our organization settings?
Thank you for your assistance!
We’ll also share this with our SonarCloud contact for further validation.
Best regards,