Incorrect ConditionIsAlwaysTrueOrFalse

I have this code for which R# seems to think my success case is heuristically unreachable. This is demonstrably false.

                    if (output != null && output.Count >= 2)
                    {
                        ArrayList accountList = null;
                        bool successMessageFound = false;
                        foreach (PSObject obj in output)
                        {
                            if (!successMessageFound && obj.BaseObject is string && (obj.BaseObject as string).Contains("success"))
                            {
                                successMessageFound = true;
                            }
                            else if (accountList == null && obj.BaseObject is ArrayList)
                            {
                                accountList = obj.BaseObject as ArrayList;
                            }

                            // ReSharper disable once ConditionIsAlwaysTrueOrFalse - Reason: Incorrect analysis
                            // ReSharper disable HeuristicUnreachableCode - Reason: Incorrect analysis
                            if (accountList != null && successMessageFound)
                            {
                                result.Passed = true;
                            }
                            // ReSharper restore HeuristicUnreachableCode
                        }
                    }

Please sign in to leave a comment.