-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Do not use ReferenceEquals with impossible types #37691
Comments
apart from the obvious ReferenceEquals(type, typeThatIsntDerivedOrBaseOfOtherType) would this also apply to value types? Given ReferenceEquals(someStruct, someStruct) will always be false currently because they are boxed to different instances. Although, if boxing pooling happened, this could change |
|
cc: @bartonjs |
@stephentoub do we usually keep issues like this open here or do we usually move them to roslyn repo? |
I thought the one you pointed at (also @stephentoub pointed at) was only for value types, and this issue was for both that and reference types. Should we reopen to track that part? |
Oh, right, yeah. That made sense to me at the time, too. Today, however, I got confused. |
Similar to #33770.
Warn if use of
ReferenceEquals
would provably always be false based upon the types of the arguments.Category: Reliability
The text was updated successfully, but these errors were encountered: