Fix SelectArrayIterator.MoveNext after Dispose#12523
Fix SelectArrayIterator.MoveNext after Dispose#12523stephentoub merged 5 commits intodotnet:masterfrom
Conversation
|
Thanks. Can you please add a test? |
|
@stephentoub All done. I also made the fix a bit shorter. |
There was a problem hiding this comment.
Assert.False(e.MoveNext());
There was a problem hiding this comment.
Why a TheoryData rather than a normal MemberData?
There was a problem hiding this comment.
I like TheoryData a bit better because it guarantees type/arity safety, e.g. you can't pass in the wrong type or the wrong number of arguments to it.
There was a problem hiding this comment.
Understood. But we have close to zero use of it across the repo, whereas InlineData and MemberData are used pervasively. I would rather we not diverge from that except where we have very good reasons for doing so. Different people can prefer different things.
|
Thanks, @jamesqo. |
Just realized that there was a small issue with my changes in #11841: if someone tries to
MoveNexton aSelectArrayIteratorafter it's Disposed, then an IOOR exception will be generated because we try to access index -2. This is the fix.Repro:
cc @stephentoub, @VSadov