Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE0051 false positive, all private members are shown as unused (light grey font color) #76857

Open
cremor opened this issue Jan 22, 2025 · 0 comments
Labels
Area-IDE Feature - IDE0051 Remove unused private members untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@cremor
Copy link

cremor commented Jan 22, 2025

Version Used: Visual Studio 17.12.4

Steps to Reproduce:
I don't know how to reproduce it. But I can share the following information:

  • It seems to mostly happen when I start or stop debugging my application.
  • It also happens when I close a Git compare window of a file (which switches back to the normal view of the file).
  • This is in a big .NET Framework 4.8 WPF solution. I don't know yet if this can also happen with other target frameworks.
  • It only affects private instance members. Static members and members that are partial themselves are not affected.
  • When it happens then all of the private instance members of the file are affected.
  • It might be that this only affects members in partial classes. The usage is in the same partial (same file).
  • I only noticed this problem after I updated from VS 17.12.3 to 17.12.4, so it might be a new bug in 17.12.4.

Diagnostic Id: "IDE0051: Remove unused private member"

Expected Behavior:
Used private members should not be shown as unused.

Actual Behavior:
Used private members show IDE0051 and are shown in light grey font color.
Sometimes the problem automatically fixes itself when I stop debugging.
It always fixes itself when I hit F6 to compile the solution.

As you can see in this screenshot, it even shows the reference above the member, but still shows IDE0051:

Image

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 22, 2025
@deepakrathore33 deepakrathore33 added the Feature - IDE0051 Remove unused private members label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature - IDE0051 Remove unused private members untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

2 participants