Просмотр исходного кода

AsyncEnumerable.ToObservable: Use Try...-methods on TaskCompletionSources to avoid unexpected exceptions when the iterator is cancelled.

Daniel Weber 8 лет назад
Родитель
Сommit
f47d85ef7c
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      Ix.NET/Source/System.Interactive.Async/ToObservable.cs

+ 3 - 3
Ix.NET/Source/System.Interactive.Async/ToObservable.cs

@@ -119,7 +119,7 @@ namespace System.Linq
 
 
                 if (tcs != null)
                 if (tcs != null)
                 {
                 {
-                    tcs.SetResult(false);
+                    tcs.TrySetResult(false);
                 }
                 }
             }
             }
 
 
@@ -140,7 +140,7 @@ namespace System.Linq
 
 
                 if (tcs != null)
                 if (tcs != null)
                 {
                 {
-                    tcs.SetException(error);
+                    tcs.TrySetException(error);
                 }
                 }
             }
             }
 
 
@@ -165,7 +165,7 @@ namespace System.Linq
 
 
                 if (tcs != null)
                 if (tcs != null)
                 {
                 {
-                    tcs.SetResult(true);
+                    tcs.TrySetResult(true);
                 }
                 }
             }
             }
         }
         }