Skip to content
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

Fix CA1853 firing when another dictionary used for ContainsKey #6516

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

louis-z
Copy link
Contributor

@louis-z louis-z commented Mar 6, 2023

Only if ContainsKey() & Remove() are invoked on the exact same field, property, parameter or local variable will the CA1853 rule now kick in.

Note that, as a result, if the methods are called using syntactically different but semantically equal references (e.g. 2 variables that have reference equality), the rule will not trigger.

Fixes #6377

@louis-z louis-z changed the title Add test and make it pass Fix CA1853 firing when another dictionary used for ContainsKey Mar 6, 2023
@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Merging #6516 (2bc8408) into main (c6352bf) will decrease coverage by 0.01%.
The diff coverage is 91.80%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6516      +/-   ##
==========================================
- Coverage   96.41%   96.41%   -0.01%     
==========================================
  Files        1371     1371              
  Lines      319166   319224      +58     
  Branches    10270    10271       +1     
==========================================
+ Hits       307732   307784      +52     
- Misses       8979     8981       +2     
- Partials     2455     2459       +4     

@louis-z louis-z marked this pull request as ready for review March 6, 2023 23:18
@louis-z louis-z requested a review from a team as a code owner March 6, 2023 23:18
@louis-z louis-z marked this pull request as draft March 7, 2023 14:46
@louis-z louis-z force-pushed the issue-6377 branch 4 times, most recently from 6805e3c to b8351d8 Compare March 9, 2023 01:32
@louis-z louis-z marked this pull request as ready for review March 9, 2023 01:33
@mavasani mavasani merged commit c0d25e2 into dotnet:main Mar 9, 2023
@github-actions github-actions bot added this to the vNext milestone Mar 9, 2023
@louis-z louis-z deleted the issue-6377 branch January 5, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CA1853 firing when another dictionary is used for ContainsKey
3 participants