-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
No ability to disable fading for unused private methods analyzer #76396
Comments
I started suppressing the IDE0051 with a GlobalSuppression.cs in my project but it’s time expensive and I don’t find this to be appropriate for some reasons:
Said that, I don’t like the current behavior at all. |
Seems reasonable to have an option here. |
BTW, I hope we don't end up in only having to use an attribute to suppress it. |
As mentioned, it seems reasonable for there to be an option controlling this. |
@CyrusNajmabadi What about making the current "Fade out unreachable code" option apply to this as well? |
@sharwell i'm not opposed to that. both are conceptually 'unreachable' either because flow analysis says we can't reach a particular statement, or because there's no reference to some private member. |
We would take an appropriately sized community pr here. |
The current fade-out behaviour is disruptive. When writing new private methods, they are not immediately used, and I do not want them to be greyed out. However, the concept of fading out unused methods is excellent. My recommendation is to include a menu item (possibly in the code analyzer) that allows developers to manually check for unused methods in the code. This approach aligns better with the typical development process. |
Would it be possible to disable fading when the cursor or caret is on that code block? |
Perfect summary! - it seems an introduced 'feature' which should have therefore been 'opt-in' or easily disabled by a menu option. Personally I really dislike it! |
How does the analyzer read the VS checkboxes values? |
This behavior is now even worse in 17.13. Untitled.mp4 |
Roslyn does not control how fading looks. For that, please file an issue with visual studio (that is not us) If you want to disable fading for this, you can do so @janseris |
That is not Roslyn. Please file reports with visual studio.
That is not Roslyn. Please let razor or visual studio know.
I'm unaware of any slowdowns here (no customer telemetry indicates any issues there). If you are having issues with these, please file issues. It may be something specific to your configuration. |
Thank you for clarification. I have been filing issues like crazy in Visual Studio Feedback since launch of Visual Studio 2022 in winter 2021 but nothing changed. I give up. GitHub issues are at least tracked by people who understand it. Visual Studio Feedback has some tech support people who usually do not understand the issue at all because they seem to be not coding in Visual Studio or C# at all. I have had very hard times explaining. What is exactly Roslyn? That will help me distinguish where to write the issue.
How can I disable the fading completely like it was in 17.10 or 17.11 and older (or just reverting to 17.10 would be enough! but I can't do it, I can just revert to previous Visual Studio version which is some kind of 17.12 patch which already has all the issues).
I have no specific configuration but I have large solutions (50 to 90 projects). Thank you |
Sorry about that. We can't help with that. It's up to individual vs teams to prioritize issues. If they get very low volumes of feedback, they will often not view a change a worth making (same with us)
We provide c# and VB language analysis support. That then plugs into tools like VS/VSCode/other-tools to give rich language understanding.
There is an option under tools|options|languages|c#|advanced controlling fading. I'm not in front of a computer, so I can't provide a screen shot right now. It will be something like: fade unused members. |
FYI: I just found a bug. @CyrusNajmabadi is this a Roslyn or a VS bug? (Where should I open the issue?) |
That's a Roslyn bug. |
@CyrusNajmabadi do you want me to open a new issue or you keep this one as the reference for this bug? |
Make a new issue. This issue is closed as completed. |
Summary
IDE00051 basically grays out unused private methods. Customers are not liking this but also don't want to disable the analyzer all together. It's the visual representation that is annoying. There are also areas where methods are used dynamically that analyzers don't know about.
Background and Motivation
We have other analyzers that 'fade' views, but we enable a toggle to disable the fade.

Proposed Feature
Add the ability to disable the fade with this analyzer
The text was updated successfully, but these errors were encountered: