Skip to content

C# Warning CA1822 is Too Aggressive, and the Fixup breaks Some Features #7833

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]
C# Warning CA1822 is used on public interfaces, for example:

public List<Person> People => people;

Generates the warning (because 'people' is a static list) and suggests a fixup of

public static List<Person> People => people;

However, that breaks XAML bindings like:

ItemsSource="{Binding People}"

You can see an example of the code above in https://github.com/david-maw/CollectionViewTest-sizezero.git, an example program meant to illustrate a different problem.


Original Comments

Feedback Bot on 6/8/2026, 03:22 AM:

Based on similar issues resolved with Microsoft in the last 6 months, the following can help resolve this issue faster.

If not already included, please provide:

Detected: OS: 10.0.26200.0 VS: Insiders [11811.120], Product: community-2026, Project type: C#

Please share:

  • The exact CA1822 warning/fixup scenario you’re seeing: which code action you used, and what “breaks some features” means in practice.
  • A small before/after code snippet showing the member before the CA1822 fixup and after it.
  • The specific feature(s) that stopped working after applying the fix.
  • Whether this happens in a new/simple C# project or only in one solution.
  • The exact Visual Studio steps to reproduce the issue from start to finish.

Feedback Bot on 6/9/2026, 08:53 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions