-
Notifications
You must be signed in to change notification settings - Fork 467
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
[release/8.0.1xx] Address CA1862 cases to diagnose and to fix and improve messages #6948
[release/8.0.1xx] Address CA1862 cases to diagnose and to fix and improve messages #6948
Conversation
@jeffhandley @ericstj @artl93 can you please consider this backported fix for release/8.0.1xx? |
Codecov Report
@@ Coverage Diff @@
## release/8.0.1xx #6948 +/- ##
===================================================
- Coverage 96.39% 96.39% -0.01%
===================================================
Files 1402 1402
Lines 331865 332092 +227
Branches 11028 11057 +29
===================================================
+ Hits 319916 320130 +214
- Misses 9188 9194 +6
- Partials 2761 2768 +7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ensure we have translation hand back before GA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
M2 approved
Backport of #6928 to release/8.0.1xx
/cc @carlossanlop
Fixes dotnet/runtime#89740
Customer Impact
The purpose of analyzer CA1862 is to determine if string comparisons (StartsWith, Contains, IndexOf, CompareTo, abd binary comparisons of string equality) are changing case and culture and suggest using other more performant methods that allow choosing a culture and casing handling properly. In some cases, the analyzer offers a fix, while in other cases it only offer a diagnosis and tells the user to manually determine what to do.
Unfortunately, the analyzer was changing semantics for some of the offered fixes, specifically those where the user was incorrectly comparing different cultures. This PR addresses that problem by avoiding offering fixes for those cases, and additionally improves the messages so that the user gets a more detailed explanation of the problem and what they need to do to address the problem manually.
Testing
Risk
Low. The analyzer is new and we're fixing specific cases while preserving the majority of correct ones.