Misevaluation of boolean using nullable types

Version: Version 9.3 (build 51899)
Rule: csharpsquid:S2589 Boolean expressions should not be gratuitous

bool hasAuthorize =
          context.MethodInfo.DeclaringType?.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() ?? false
          || context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any();

Hey there.

Thanks for the report. This is a known false-positive you can track here: Fix S2589 FP with nullable value types · Issue #5221 · SonarSource/sonar-dotnet · GitHub