Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d9f76a8

Browse files
committed
Merge pull request #2289 from justinvp/ioiterator
Check the state before fetching the thread id
2 parents a61182c + 2b8337a commit d9f76a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/System.IO.FileSystem/src/System/IO/Iterator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected virtual void Dispose(bool disposing)
4141

4242
public IEnumerator<TSource> GetEnumerator()
4343
{
44-
if (_threadId == Environment.CurrentManagedThreadId && state == 0)
44+
if (state == 0 && _threadId == Environment.CurrentManagedThreadId)
4545
{
4646
state = 1;
4747
return this;

0 commit comments

Comments
 (0)