소스 검색

Improving compat MoveNext async extension method to honor cancellation.

Bart De Smet 8 년 전
부모
커밋
2d2ec8d939
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      Ix.NET/Source/System.Interactive.Async/IAsyncEnumerator.cs

+ 5 - 0
Ix.NET/Source/System.Interactive.Async/IAsyncEnumerator.cs

@@ -45,6 +45,11 @@ namespace System.Collections.Generic
         /// </returns>
         public static Task<bool> MoveNextAsync<T>(this IAsyncEnumerator<T> source, CancellationToken cancellationToken)
         {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            cancellationToken.ThrowIfCancellationRequested();
+
             return source.MoveNextAsync();
         }
     }