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).

Change this condition so that it does not always evaluate to ‘false’; some subsequent code is never executed.

private void StartupProject()
            if (StartupParameters?.HasStartupProject ?? false)


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.


Hi Ann,

Thanks for your reply, I didn’t get a notification on your reply (I’ve changed my settings now :smile:).

Yes indeed, the language is C#, sorry for leaving that ou!

We’ll plan an upgrade, I’ll let you know afterwards.

Kind regards,

Hi @NicoBrabers!

Have you managed to do the upgrade? It fix the problem?

On my side, I could not reproduce the issue. I’ve tried with the following snippet:

public class TestCase_S2583
    public void StartupProject(StartupParameters startupParameters)
        if (startupParameters?.HasStartupProject ?? false)

    private void OpenProject(string fileName)

    public class StartupParameters
        public bool? HasStartupProject { get; set; }
        public string FileName { get; set; }

Hi @costin.zaharia,

Thanks for reproducing and following up!

The upgrade has been scheduled, so I can’t wait to see if we’ll have the same results. Probably will!

I’ll address the issue as soon as our environment has been upgraded.

1 Like

Hi @NicoBrabers, I will close the thread for now since we cannot take any action. Please open another one if the problem does not get solved.