Tuples and S1172, S2583 false positive

It looks like some C# 8 features and tuples in general causes problems on sonarqube rules.

This is recognized as error:

static State ChangeState(State current, Transition transition, bool hasKey) =>
    (current, transition, hasKey) switch
    {
        (Opened, Close,  _)    => Closed,
        (Closed, Open,   _)    => Opened,
        (Closed, Lock,   true) => Locked,
        (Locked, Unlock, true) => Closed,
        _ => throw new InvalidOperationException($"Invalid transition")
    };

Same with this (S2583):

    UserProfile profile = null;
    UserRights rights = null;
    ....
    (profile ,rights) = await Task.Run(() => ...

The assignment is not recognized.

Version 8.3.0.14607

Cheers,
Marco

thanks @mlop3s for opening this topic

We have the following open issues for Tuple FPs

They’re all probably related to Add support for TupleExpressions in CSharpExplodedGraph.

Yes, they are related. Could not find them by searching fo tuples. Thanks.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.