admin管理员组文章数量:1026989
I updated my "Visual Studio Community Edition 2022" to version 17.12.0. Now all code of C# private and protected methods are ugly. Please, see image.
How I can disable it? I want equal appearence for private and public methods in C#.
Here is my settings for fading at TextEditor/C#/Advanced:
I tried to find a setting that would change the color of the private methods, but I couldn't. I also tried many other themes, but the result was the same. By the way, many good color themes have now started to look much worse. In some of them half of the code is completely grayed out.
I updated my "Visual Studio Community Edition 2022" to version 17.12.0. Now all code of C# private and protected methods are ugly. Please, see image.
How I can disable it? I want equal appearence for private and public methods in C#.
Here is my settings for fading at TextEditor/C#/Advanced:
I tried to find a setting that would change the color of the private methods, but I couldn't. I also tried many other themes, but the result was the same. By the way, many good color themes have now started to look much worse. In some of them half of the code is completely grayed out.
Share Improve this question edited Nov 16, 2024 at 15:23 pfx 23.4k48 gold badges84 silver badges109 bronze badges asked Nov 16, 2024 at 14:49 EugeneEugene 1458 bronze badges 5 |4 Answers
Reset to default 4Thanks Hans Passant for comment. Solution available at this link: https://developercommunity.visualstudio/t/unused-private-member-IDE0051-fading-e/10781612
To disable the rule for your entire project, add the following to your
.editorconfig file on root projects alongside “.sln”:
[*.cs] dotnet_diagnostic.IDE0055.severity = none dotnet_diagnostic.IDE0052.severity = none dotnet_diagnostic.IDE0051.severity = none dotnet_diagnostic.IDE0044.severity = none
Now VS Community 2022 ver. 17.13.6 has one more checkbox of fading unused members. Unchecking it results the unused members are not faded out
I have created a small extension to disable this fading: https://visualstudioextensions.vlasovstudio/2024/11/22/customizing-unreachable-code-fading-in-visual-studio-with-visual-commander/
To disable the fade out for unused methods, do the following:
- Open Tools -> Options.
- Select C#.
- Select Advanced.
- In "Anylysis", change "Run background code analysis for:" to "None"
- Click "OK".
I updated my "Visual Studio Community Edition 2022" to version 17.12.0. Now all code of C# private and protected methods are ugly. Please, see image.
How I can disable it? I want equal appearence for private and public methods in C#.
Here is my settings for fading at TextEditor/C#/Advanced:
I tried to find a setting that would change the color of the private methods, but I couldn't. I also tried many other themes, but the result was the same. By the way, many good color themes have now started to look much worse. In some of them half of the code is completely grayed out.
I updated my "Visual Studio Community Edition 2022" to version 17.12.0. Now all code of C# private and protected methods are ugly. Please, see image.
How I can disable it? I want equal appearence for private and public methods in C#.
Here is my settings for fading at TextEditor/C#/Advanced:
I tried to find a setting that would change the color of the private methods, but I couldn't. I also tried many other themes, but the result was the same. By the way, many good color themes have now started to look much worse. In some of them half of the code is completely grayed out.
Share Improve this question edited Nov 16, 2024 at 15:23 pfx 23.4k48 gold badges84 silver badges109 bronze badges asked Nov 16, 2024 at 14:49 EugeneEugene 1458 bronze badges 5-
Visual Studio typically only does this for unused methods. So the fact the methods are public and private per-se doesn't affect this. Except, given the name of the functions here I suppose these may be test methods and usually those have to be
public
so the test is discovered and therefore the function is used. I would assume once you add a call totest2()
fromtest1()
it will appear exactly the same astest1()
as it is then used. – Mushroomator Commented Nov 16, 2024 at 14:56 - Ok, how to disable it for "unused" methods? – Eugene Commented Nov 16, 2024 at 14:58
- 6 developercommunity.visualstudio/t/… – Hans Passant Commented Nov 16, 2024 at 15:29
- It will be considered as potentially used if you make it public, even when not called anywhere. Fading is actually very useful as it allows you to safely delete unused members. – Olivier Jacot-Descombes Commented Nov 16, 2024 at 15:33
- As mentioned in the DC link provided in the comments above, this feature request has been reported by relevant users, and you can go to the link and vote. It should be noted that Microsoft may only consider adding this feature if enough users report this request. If there is any follow-up progress, please also update this post. – Cody Liang Commented Nov 18, 2024 at 3:24
4 Answers
Reset to default 4Thanks Hans Passant for comment. Solution available at this link: https://developercommunity.visualstudio/t/unused-private-member-IDE0051-fading-e/10781612
To disable the rule for your entire project, add the following to your
.editorconfig file on root projects alongside “.sln”:
[*.cs] dotnet_diagnostic.IDE0055.severity = none dotnet_diagnostic.IDE0052.severity = none dotnet_diagnostic.IDE0051.severity = none dotnet_diagnostic.IDE0044.severity = none
Now VS Community 2022 ver. 17.13.6 has one more checkbox of fading unused members. Unchecking it results the unused members are not faded out
I have created a small extension to disable this fading: https://visualstudioextensions.vlasovstudio/2024/11/22/customizing-unreachable-code-fading-in-visual-studio-with-visual-commander/
To disable the fade out for unused methods, do the following:
- Open Tools -> Options.
- Select C#.
- Select Advanced.
- In "Anylysis", change "Run background code analysis for:" to "None"
- Click "OK".
本文标签: cHow to disable fading unused methods in Visual Studio 2022 17120Stack Overflow
版权声明:本文标题:c# - How to disable fading unused methods in Visual Studio 2022 17.12.0? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745656109a2161606.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
public
so the test is discovered and therefore the function is used. I would assume once you add a call totest2()
fromtest1()
it will appear exactly the same astest1()
as it is then used. – Mushroomator Commented Nov 16, 2024 at 14:56