Skip to content

MA0151 false positive #831

@dmitriy-maksimov-wd

Description

@dmitriy-maksimov-wd

Version of the Meziantou.Analyzer NuGet package

2.0.216

Rule Identifier

MA0151

Target Framework

net8.0

C# Language version

C# 11

Description

I have IList<> member.
Getting "Member Count does not exist", but the member exists in ICollection (which IList<> derived from).
The recent fix #830 seems to broke it.

Reproduction Steps

Minimal code:

[DebuggerDisplay("{referenceString} ({allStrings.Count})")]
public struct ContainedStrings
{
    private readonly IList<string> allStrings;
    private readonly string referenceString;

    public void Test()
    {
        var allStringsCount = allStrings.Count;
    }
}

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions