-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
ItemDictionary<T>.Enumerator has an unnecessary finalizer #7211
ItemDictionary<T>.Enumerator has an unnecessary finalizer #7211
Conversation
…/msbuild into itemdictionary-remove-finalizer
This looks like the nested enumerator type could be replaced with an iterator method: nested Iterators do not support IEnumerator.Reset() but the current implementation of Reset is bogus anyway: it resets _itemEnumerator too, so if you had the hierarchy ((A B C) (D E F)) and the current item is E, then after the reset, it will enumerate (D E F A B C D E F) even though the right answer would be just (A B C D E F). Which perhaps indicates that nothing actually calls Reset. |
@KalleOlaviNiemitalo that's indeed a bug, thank you. It looks like we should do _itemEnumerator = GetNextItemEnumerator(); instead of resetting whatever |
In principle, Reset and MoveNext should also call |
Could one of you please write up an issue to spec out this suggestion? It sounds like a good idea. |
Filed #7286. |
Fixes #7208