We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33151e0 commit ed71e55Copy full SHA for ed71e55
src/MongoDB.Driver/Sync/AsyncCursorEnumeratorAdapter.cs
@@ -42,14 +42,21 @@ public IEnumerator<TDocument> GetEnumerator()
42
throw new ObjectDisposedException(GetType().FullName);
43
}
44
45
- while (_cursor.MoveNext(_cancellationToken))
+ try
46
{
47
- var batch = _cursor.Current;
48
- foreach (var document in batch)
+ while (_cursor.MoveNext(_cancellationToken))
49
50
- yield return document;
+ var batch = _cursor.Current;
+ foreach (var document in batch)
51
+ {
52
+ yield return document;
53
+ }
54
55
56
+ finally
57
58
+ Dispose();
59
60
61
62
public void Dispose()
0 commit comments