This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Fix disposal of enumerators in EnumerablePartition#14979
Merged
stephentoub merged 2 commits intodotnet:masterfrom Jan 12, 2017
Merged
Fix disposal of enumerators in EnumerablePartition#14979stephentoub merged 2 commits intodotnet:masterfrom
stephentoub merged 2 commits intodotnet:masterfrom
Conversation
stephentoub
reviewed
Jan 9, 2017
Member
There was a problem hiding this comment.
Nit: if you were to change the implementation in the ctor to:
_getEnumerator = getEnumerator ?? () => this;then I think you could change this to:
var source = new DelegateIterator<int>(
moveNext: ...etc., and not have to do this dance with defining the variable separately. You might even choose to remove ghet getEnumerator entirely and just always have it return this.
JonHanna
approved these changes
Jan 9, 2017
Member
|
LGTM. Thanks! |
VSadov
approved these changes
Jan 9, 2017
87675db to
561878f
Compare
Contributor
Author
|
Test Innerloop OSX Debug Build and Test (build timed out) |
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
* Fix disposal of enumerators in EnumeratorPartition Commit migrated from dotnet/corefx@73daf67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: I found out while adding a new API in #14186 that I had forgotten to override
DisposeinEnumerablePartition, which is returned bySkip/Take. This fixes that and adds corresponding tests to make sure the source enumerator is disposed properly. I also made some of the test code I had written in an earlier PR a bit cleaner.Related: #13628
/cc @JonHanna @stephentoub @VSadov