-
Type:
Improvement
-
Resolution: Done
-
Priority:
Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Dotnet Drivers
-
None
-
None
-
None
-
None
-
None
-
None
The terminal operators Any/AnyAsync, First/FirstAsync, FirstOrDefault/FirstOrDefaultAsync, Single/SingleAsync, and SingleOrDefault/SingleOrDefaultAsync in IAsyncCursorExtensions (src/MongoDB.Driver/Core/IAsyncCursor.cs) do not validate the cursor argument. Passing a null cursor surfaces a NullReferenceException from inside the method body rather than a clear ArgumentNullException.
The sibling terminal operators in the same class — ForEachAsync, ToList, ToListAsync — already guard with Ensure.IsNotNull(source, nameof(source)). This ticket makes the Any/First/Single family consistent with them and with the driver-wide argument-validation convention.
Context: identified during review of CSHARP-5630 (adding IAsyncDisposable to cursors). This is a pre-existing gap unrelated to that change and was intentionally kept out of that PR.