-
Notifications
You must be signed in to change notification settings - Fork 484
[release/8.0.1xx] Add analyzer/fixer to suggest using cached SearchValues instances #6924
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
Conversation
Codecov Report
@@ Coverage Diff @@
## release/8.0.1xx #6924 +/- ##
===================================================
- Coverage 96.40% 96.39% -0.01%
===================================================
Files 1396 1402 +6
Lines 330339 331860 +1521
Branches 10882 11027 +145
===================================================
+ Hits 318453 319912 +1459
- Misses 9159 9186 +27
- Partials 2727 2762 +35 |
(I'm lacking perms to edit the above comment) Customer Impact
The main benefit is giving users an easy way to boost searching performance by doing the code rewriting for them, as well as raising their awareness of the new feature's existence. Through telemetry, we know that many of the patterns flagged by this analyzer (e.g. TestingDecent code coverage was added as part of this PR. RiskIt's another analyzer users may have to disable/adjust code fixes for in projects that also target older TFMs where the |
Thanks, updated the description |
Did you mean "false positives" here by chance? As in, a positive match for where the analyzer would raise a diagnostic, but it was an erroneous diagnostic? |
Oops, yes, should be false positives. |
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.
This has my support for .NET 8 RC2. The analyzer guides users to adopt the new net8 SearchValues
API to improve performance of their existing code, completing the end-to-end experience for this new API.
The analyzer is Info-level by default, which means it can be introduced in a non-breaking way.
We should enable the analyzer in main
for aspnetcore, efcore, and perhaps other dotnet org repos where it's likely the older APIs are being used.
Tagging @artl93 for RC2 consideration.
M2 approved. Thanks! |
Backport of #6898 to release/8.0.1xx
/cc @MihaZupan
Customer Impact
SearchValues
is a new .NET 8 feature, and it'd be very nice to have a better end-to-end story for the release by having the analyzer/fixer shipping together with the library support it targets.The main benefit is giving users an easy way to boost searching performance by doing the code rewriting for them, as well as raising their awareness of the new feature's existence.
Through telemetry, we know that many of the patterns flagged by this analyzer (e.g.
IndexOfAny(new[] { ... })
orreadonly char[] _myField = ...;
) are quite often used by users of these APIs.Testing
Decent code coverage was added as part of this PR.
Running the analyzer against dotnet/runtime flagged only 3 places that we haven't updated manually yet in projects that multi-target older TFMs. It hit no false positives.
Risk
It's another analyzer users may have to disable/adjust code fixes for in projects that also target older TFMs where the
SearchValues
API is not available.