-
Notifications
You must be signed in to change notification settings - Fork 983
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
Enable nullability in BindingContext and HashKey #7108
Conversation
@@ -47,7 +44,7 @@ int ICollection.Count | |||
void ICollection.CopyTo(Array ar, int index) | |||
{ | |||
ScrubWeakRefs(); | |||
_listManagers.CopyTo(ar, index); | |||
new Hashtable(_listManagers).CopyTo(ar, index); |
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.
I am not sure about this change. If we use ((ICollection)_listManagers).CopyTo(
instead, some tests such as BindingContext_CopyTo_Invoke_Success
will fail because the type has changed from DictionaryEntry to KeyValuePair. If modifying the tests is acceptable, then the next issue is that HashKey
is private, so we cannot just use that in the assertions. Assuming that we don't just want to make HashKey
internal, there might be an alternative approach to achieve what the current assertions do?
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.
In this case updating the test is totally justified
ArrayList cleanupList = null; | ||
foreach (DictionaryEntry de in _listManagers) | ||
List<HashKey> cleanupList = null; | ||
foreach (KeyValuePair<HashKey, WeakReference> de in _listManagers) |
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.
Can we do deconstruction here? E.g., something like:
foreach (KeyValuePair<HashKey, WeakReference> de in _listManagers) | |
foreach ((HashKey key, WeakReference wRef) in _listManagers) |
Related #8143 Great work with this! I'd love to see it merged. |
c8218f4
to
4c142fa
Compare
4c142fa
to
05ebc8c
Compare
@dreddy-work could we also merge this one? #8235 should take care of the ArrayList/Hashtable replacements. |
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.
LGTM.
Proposed changes
Microsoft Reviewers: Open in CodeFlow