S1125 Boolean literals should not be redundant False Positive

  • Operating system: Windows 11
  • IDE name and flavor/env: Rider 2026.2.1

And a thorough description of the problem / question:

context.User.Identity?.IsAuthenticated != true

I’m getting a false positive in the Sonar IDE for S1125 on the line above. The return type of this expression is bool? so true is needed here because it needs to handle the null case.

This only happens in the IDE plugin, it does not seem to happen in the analyzers. Not sure if one is ahead of the other, but figured I should report it in case the IDE is ahead so the rule can be fixed before it bites other products. Thanks.

Hey @groogiam, thanks for reporting this! Before I relay it to the devs, I’d like to clarify your comment that this issue only pops up on the IDE but not “in the analyzers” (I assume you mean CI analysis, but it’s also possible you’re using automatic analysis on SonarQube Cloud).

Could you let us know:

  • Which product (SonarQube Community Build, Server or Cloud?) and version (if applicable) are you using?
  • Are you using SonarQube for IDE in connected mode (bound to your SonarQube instance/Cloud org)?
    • If yes, could you also please try running in on “standalone” mode (not connected) and seeing if that affects the detection of the issue?
    • If no, then please try the opposite: configure connected mode and check if the issue is still detected.

@andres

I was referring to the SonarAnalyzer.CSharp nuget package did not seem to trigger this. I am not using Sonar IDE in connected mode. I discovered this working on a proof of concept that I do not have hooked up to an actual sonar qube / cloud instance. Hope this helps. Thanks.

Hi @groogiam,

Thank you for reporting this issue.

I’ve tried to reproduce it locally with latest version of Rider IDE + latest version of SonarQube for IDE plugin (v12.8.0.85170) but I was not able to reproduce it.

To me, SonarQube for IDE plugin is not raising an issue at line 25 but it does at line 29 so the analysis is correct.

Can you please check if you’re using an old version of the plugin ? If so, try to update the plugin first and if you still see the issue after that, please let us know.

Best Regards,
Erwan Le Forestier