Skip to content

Compound assignments not considered to invoke get accessor (IDE0052) #81821

@envoidia

Description

@envoidia

Version Used: 5.3.0-2.25603.1

Steps to Reproduce:

private int Foo { get; set; }
private void Bar() => Foo += 10;

IDE0052: Private member 'Foo' can be removed as the value assigned to it is never read

This only happens with compound assignment, and appears to happen with any of the compound assignment operators (except ??=). It also happens with full properties, and even when Bar() is explicitly called

Expected Behavior: It understands that compound assignments invoke get

Actual Behavior: It doesn't

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions