False-positive on "? false" in if statement

SonarQube, version 8,5 (build, 37579).
Scanner (for Jenkins), version 2.12

Getting the error underneath, which is clearly a false-positive. Somehow “?? false” seems to cause the problem. The property HasStartupProject is set to true based on the parameters we’ve sent to the application (might be false sometimes as well).

Error:
Change this condition so that it does not always evaluate to ‘false’; some subsequent code is never executed.
http://cwe.mitre.org/data/definitions/570.html

private void StartupProject()
        {
            if (StartupParameters?.HasStartupProject ?? false)
                OpenProject(StartupParameters.FileName);
        }

Hi,

Welcome to the community!

I’m guessing this is C#…?

We do work on the major languages in each version and there have been several versions since 8.5. In fact, your version is EOL now. You should upgrade at your earliest convenience. Your upgrade path is:

8.5 → 8.9.1 → 9.0 (last step optional)

Please report back to us (and identify the language! :slightly_smiling_face: ) if that doesn’t resolve the problem.

 
:smiley:
Ann