dotnet / roslyn-analyzers

MIT License
1.58k stars 464 forks source link

Visual Studio Refactoring: Provide Refactoring for CA1863 #7359

Open vsfeedback opened 1 month ago

vsfeedback commented 1 month ago

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


In code analysis, it states, "Cache and use a 'CompositeFormat' instance as the argument to this formatting operation, rather than passing in the original format string. This reduces the cost of the formatting operation." Based on my benchmark analysis, this approach indeed speeds up formatting. For more details, see: https://dotnettips.wordpress.com/2024/06/23/string-performance-improving-string-formatting-performance-by-a-factor-of-1-5-or-more/

Given that projects could have hundreds to thousands of these violations, could Visual Studio provide a refactoring tool to automate this optimization? This would be extremely helpful for developers working on projects that utilize resource files extensively.


Original Comments

Feedback Bot on 6/26/2024, 10:17 PM:

(private comment, text removed)

buyaa-n commented 3 weeks ago

It would be helpful to specify which diagnostic could suggest what fix, could see some example from the original issue https://github.com/dotnet/runtime/issues/85525#issuecomment-1572548360