-
Notifications
You must be signed in to change notification settings - Fork 470
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 CA2021 false positive for generic class types #7488
Conversation
@dotnet-policy-service agree [company="Microsoft"] |
@dotnet-policy-service agree company="Microsoft" |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7488 +/- ##
=======================================
Coverage 96.50% 96.50%
=======================================
Files 1450 1450
Lines 347319 347362 +43
Branches 11409 11409
=======================================
+ Hits 335184 335232 +48
+ Misses 9244 9241 -3
+ Partials 2891 2889 -2 |
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.
Thanks @danpere! I make sure this gets back-ported to 9.0.1xx
As per #7357 (comment) this became un-fixed in SDK 9.0.200 |
Fix for #7357.
#7183 changed the
CastWillAlwaysFail(ITypeSymbol castFrom, ITypeSymbol castTo)
to work withcastFrom.OriginalDefinition
/castTo.OriginalDefinition
, eliding the generic type information in order to fix issues with interfaces, but that appears to have broken the check for class types. This reverts just the class type case to use thecastFrom
/castTo
types passed in instead of the.OriginalDefinition
. I'm not sure I quite understand why that's the only place this matters, but I tried a few variations withstruct
s andinterface
s and couldn't get any other false positives.