Преглед изворни кода

Fix a number of nullable warnings.

Bart De Smet пре 6 година
родитељ
комит
0311af1adb
38 измењених фајлова са 471 додато и 587 уклоњено
  1. 0 8
      .editorconfig
  2. 5 3
      Ix.NET/Source/AsyncQueryableGenerator.t4
  3. 201 201
      Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.cs
  4. 4 4
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs
  5. 1 3
      Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj
  6. 0 10
      Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Distinct.cs
  7. 1 1
      Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Never.cs
  8. 0 3
      Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/OnErrorResumeNext.cs
  9. 1 4
      Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Timeout.cs
  10. 1 1
      Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableQuery.cs
  11. 5 5
      Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableRewriter.cs
  12. 197 197
      Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncQueryable.Generated.cs
  13. 2 2
      Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncQueryable.cs
  14. 1 4
      Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj
  15. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupBy.cs
  16. 4 4
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Join.cs
  17. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs
  18. 5 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToLookup.cs
  19. 4 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToObservable.cs
  20. 16 16
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.cs
  21. 4 2
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.tt
  22. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerablePartition.cs
  23. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerator.cs
  24. 1 1
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncListPartition.cs
  25. 1 1
      Ix.NET/Source/System.Linq.Async/System/Linq/Maybe.cs
  26. 0 2
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/AppendPrepend.cs
  27. 0 5
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Concat.cs
  28. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/DefaultIfEmpty.cs
  29. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Distinct.cs
  30. 0 22
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Lookup.cs
  31. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Reverse.cs
  32. 0 19
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs
  33. 0 10
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs
  34. 1 1
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToAsyncEnumerable.Observable.cs
  35. 0 7
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToAsyncEnumerable.cs
  36. 12 12
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToDictionary.cs
  37. 1 3
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Union.cs
  38. 0 14
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs

+ 0 - 8
.editorconfig

@@ -252,11 +252,3 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false
 csharp_space_between_method_declaration_parameter_list_parentheses = false
 csharp_space_between_parentheses = false
 csharp_space_between_square_brackets = false
-
-
-
-
-
-
-
-

+ 5 - 3
Ix.NET/Source/AsyncQueryableGenerator.t4

@@ -174,7 +174,7 @@ foreach (var m in asyncEnumerableType.GetMethods()
     {
         infoName += "__" + string.Join("_", genArgs.Select(a => a.Name));
         infoTypeArgs = "(" + string.Join(", ", genArgs.Select(a => "Type " + a.Name)) + ")";
-        infoToGeneric = ".GetGenericMethodDefinition()";
+        infoToGeneric = "!.GetGenericMethodDefinition()";
         infoMakeGeneric = ".MakeGenericMethod(" + string.Join(", ", genArgs.Select(a => a.Name)) + ")";
         infoGenArgs = "<" + string.Join(", ", genArgs.Select(_ => "object")) + ">";
     }
@@ -281,14 +281,16 @@ foreach (var m in asyncEnumerableType.GetMethods()
     }
 
     var expr = "Expression.Call(" + mtd + ", " + string.Join(", ", quotedArgs) + ")";
+
+    var cons = name.StartsWith("ToDictionary") ? " where TKey : notnull" : "";
 #>
-        private static MethodInfo s_<#=infoName#>;
+        private static MethodInfo? s_<#=infoName#>;
         
         private static MethodInfo <#=infoName#><#=infoTypeArgs#> =>
             (s_<#=infoName#> ??
             (s_<#=infoName#> = new Func<<#=infoSignature#>>(<#=m.Name#><#=infoGenArgs#>).GetMethodInfo()<#=infoToGeneric#>))<#=infoMakeGeneric#>;
 
-        public static <#=ret#> <#=name#>(<#=pars#>)
+        public static <#=ret#> <#=name#>(<#=pars#>)<#=cons#>
         {
 <#
 var any = false;

Разлика између датотеке није приказан због своје велике величине
+ 201 - 201
Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.cs


+ 4 - 4
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs

@@ -113,16 +113,16 @@ namespace Tests
             enumerable?.Dispose();
         }
 
-        private class DisposeCounter : IAsyncEnumerable<object>
+        private class DisposeCounter : IAsyncEnumerable<object?>
         {
             public int DisposeCount { get; private set; }
 
-            public IAsyncEnumerator<object> GetAsyncEnumerator(CancellationToken cancellationToken)
+            public IAsyncEnumerator<object?> GetAsyncEnumerator(CancellationToken cancellationToken)
             {
                 return new Enumerator(this);
             }
 
-            private class Enumerator : IAsyncEnumerator<object>
+            private class Enumerator : IAsyncEnumerator<object?>
             {
                 private readonly DisposeCounter _disposeCounter;
 
@@ -142,7 +142,7 @@ namespace Tests
                     return new ValueTask<bool>(Task.Factory.StartNew(() => false));
                 }
 
-                public object Current { get; private set; }
+                public object? Current { get; private set; }
             }
         }
     }

+ 1 - 3
Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj

@@ -2,10 +2,9 @@
 
   <PropertyGroup>
     <TargetFrameworks>netcoreapp2.1;net461;netcoreapp3.0</TargetFrameworks>
-    <NoWarn>$(NoWarn);CS0618</NoWarn>
+    <NoWarn>$(NoWarn);CS0618;CS8603;CS8625</NoWarn>
   </PropertyGroup>
 
-
   <ItemGroup>
     <Content Include="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -22,7 +21,6 @@
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
     <PackageReference Include="FluentAssertions" Version="5.9.0" />
     <PackageReference Include="xunit" Version="2.4.1" />
-
   </ItemGroup>
 
   <ItemGroup>

+ 0 - 10
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Distinct.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -103,9 +102,6 @@ namespace System.Linq
 
             public DistinctAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(keySelector != null);
-
                 _source = source;
                 _keySelector = keySelector;
                 _comparer = comparer;
@@ -251,9 +247,6 @@ namespace System.Linq
 
             public DistinctAsyncIteratorWithTask(IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(keySelector != null);
-
                 _source = source;
                 _keySelector = keySelector;
                 _comparer = comparer;
@@ -400,9 +393,6 @@ namespace System.Linq
 
             public DistinctAsyncIteratorWithTaskAndCancellation(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(keySelector != null);
-
                 _source = source;
                 _keySelector = keySelector;
                 _comparer = comparer;

+ 1 - 1
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Never.cs

@@ -49,7 +49,7 @@ namespace System.Linq
 
                     _once = true;
                     var task = new TaskCompletionSource<bool>();
-                    _registration = _token.Register(state => ((TaskCompletionSource<bool>)state).SetCanceled(), task);
+                    _registration = _token.Register(state => ((TaskCompletionSource<bool>)state!).SetCanceled(), task);
                     return new ValueTask<bool>(task.Task);
                 }
             }

+ 0 - 3
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/OnErrorResumeNext.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading.Tasks;
 
 namespace System.Linq
@@ -50,8 +49,6 @@ namespace System.Linq
 
             public OnErrorResumeNextAsyncIterator(IEnumerable<IAsyncEnumerable<TSource>> sources)
             {
-                Debug.Assert(sources != null);
-
                 _sources = sources;
             }
 

+ 1 - 4
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Timeout.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -34,8 +33,6 @@ namespace System.Linq
 
             public TimeoutAsyncIterator(IAsyncEnumerable<TSource> source, TimeSpan timeout)
             {
-                Debug.Assert(source != null);
-
                 _source = source;
                 _timeout = timeout;
             }
@@ -99,7 +96,7 @@ namespace System.Linq
                                 // REVIEW: Should exceptions reported by a timed out MoveNextAsync operation come out
                                 //         when attempting to call DisposeAsync?
 
-                                _loserTask = next.ContinueWith((_, state) => ((IAsyncDisposable)state).DisposeAsync().AsTask(), _enumerator);
+                                _loserTask = next.ContinueWith((_, state) => ((IAsyncDisposable)state!).DisposeAsync().AsTask(), _enumerator);
 
                                 throw new TimeoutException();
                             }

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableQuery.cs

@@ -133,7 +133,7 @@ namespace System.Linq
         /// Gets a string representation of the enumerable sequence.
         /// </summary>
         /// <returns>String representation of the enumerable sequence.</returns>
-        public override string ToString()
+        public override string? ToString()
         {
             if (!(_expression is ConstantExpression ce) || ce.Value != this)
             {

+ 5 - 5
Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableRewriter.cs

@@ -15,7 +15,7 @@ namespace System.Linq
     /// </summary>
     internal class AsyncEnumerableRewriter : ExpressionVisitor
     {
-        private static volatile ILookup<string, MethodInfo> _methods;
+        private static volatile ILookup<string, MethodInfo>? _methods;
 
         protected override Expression VisitConstant(ConstantExpression node)
         {
@@ -215,7 +215,7 @@ namespace System.Linq
                 //
                 if (type.IsByRef)
                 {
-                    type = type.GetElementType();
+                    type = type.GetElementType()!;
                 }
 
                 var expression = args[i];
@@ -328,7 +328,7 @@ namespace System.Linq
                             var newArrayExpression = (NewArrayExpression)res;
 
                             var count = newArrayExpression.Expressions.Count;
-                            var elementType = type.GetElementType();
+                            var elementType = type.GetElementType()!;
                             var list = new List<Expression>(count);
 
                             for (var i = 0; i < count; i++)
@@ -357,7 +357,7 @@ namespace System.Linq
             //
             // Array of quotes need to be stripped, so extract the element type.
             //
-            var elemType = type.IsArray ? type.GetElementType() : type;
+            var elemType = type.IsArray ? type.GetElementType()! : type;
 
             //
             // Try to find Expression<T> and obtain T.
@@ -454,7 +454,7 @@ namespace System.Linq
             return method;
         }
 
-        private static Type? FindGenericType(Type definition, Type type)
+        private static Type? FindGenericType(Type definition, Type? type)
         {
             while (type != null && type != typeof(object))
             {

Разлика између датотеке није приказан због своје велике величине
+ 197 - 197
Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncQueryable.Generated.cs


+ 2 - 2
Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncQueryable.cs

@@ -35,11 +35,11 @@ namespace System.Linq
         }
 
 #if HAS_VALUETUPLE
-        private static MethodInfo s_Zip__TFirst_TSecond__2__0;
+        private static MethodInfo? s_Zip__TFirst_TSecond__2__0;
         
         private static MethodInfo Zip__TFirst_TSecond__2__0(Type TFirst, Type TSecond) =>
             (s_Zip__TFirst_TSecond__2__0 ??
-            (s_Zip__TFirst_TSecond__2__0 = new Func<IAsyncQueryable<object>, IAsyncEnumerable<object>, IAsyncQueryable<ValueTuple<object, object>>>(Zip<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TFirst, TSecond);
+            (s_Zip__TFirst_TSecond__2__0 = new Func<IAsyncQueryable<object>, IAsyncEnumerable<object>, IAsyncQueryable<ValueTuple<object, object>>>(Zip<object, object>).GetMethodInfo()!.GetGenericMethodDefinition())).MakeGenericMethod(TFirst, TSecond);
 
         public static IAsyncQueryable<(TFirst First, TSecond Second)> Zip<TFirst, TSecond>(this IAsyncQueryable<TFirst> first, IAsyncEnumerable<TSecond> second)
         {

+ 1 - 4
Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj

@@ -2,17 +2,15 @@
 
   <PropertyGroup>
     <TargetFrameworks>netcoreapp2.1;net461;netcoreapp3.0</TargetFrameworks>
-    <NoWarn>$(NoWarn);CS0618</NoWarn>
+    <NoWarn>$(NoWarn);CS0618;CS8603;CS8625</NoWarn>
   </PropertyGroup>
 
-
   <ItemGroup>
     <Content Include="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
   </ItemGroup>
 
-
   <ItemGroup>
     <None Include="System\Linq\Operators\Average.Generated.cs">
       <DesignTime>True</DesignTime>
@@ -44,7 +42,6 @@
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
     <PackageReference Include="FluentAssertions" Version="5.9.0" />
-
     <PackageReference Include="xunit" Version="2.4.1" />
   </ItemGroup>
 

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupBy.cs

@@ -833,7 +833,7 @@ namespace Tests
                 return string.Equals(Key, other.Key) && Item == other.Item;
             }
 
-            public override bool Equals(object obj)
+            public override bool Equals(object? obj)
             {
                 if (obj is null) return false;
                 if (ReferenceEquals(this, obj)) return true;

+ 4 - 4
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Join.cs

@@ -231,19 +231,19 @@ namespace Tests
 
         public class Customer
         {
-            public string CustomerId { get; set; }
+            public string? CustomerId { get; set; }
         }
 
         public class Order
         {
             public int OrderId { get; set; }
-            public string CustomerId { get; set; }
+            public string? CustomerId { get; set; }
         }
 
         public class CustomerOrder : IEquatable<CustomerOrder>
         {
             public int OrderId { get; set; }
-            public string CustomerId { get; set; }
+            public string? CustomerId { get; set; }
 
             public bool Equals(CustomerOrder other)
             {
@@ -252,7 +252,7 @@ namespace Tests
                 return OrderId == other.OrderId && string.Equals(CustomerId, other.CustomerId);
             }
 
-            public override bool Equals(object obj)
+            public override bool Equals(object? obj)
             {
                 if (obj is null) return false;
                 if (ReferenceEquals(this, obj)) return true;

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs

@@ -177,7 +177,7 @@ namespace Tests
 
             Assert.NotNull(xc);
 
-            Assert.False(xc.IsReadOnly);
+            Assert.False(xc!.IsReadOnly);
 
             xc.Add(5);
 
@@ -202,7 +202,7 @@ namespace Tests
 
             Assert.NotNull(xl);
 
-            Assert.False(xl.IsReadOnly);
+            Assert.False(xl!.IsReadOnly);
 
             xl.Add(5);
 

+ 5 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToLookup.cs

@@ -136,8 +136,11 @@ namespace Tests
             var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
             var res = await xs.ToLookupAsync(x => x % 2);
 #pragma warning disable IDE0007 // Use implicit type
-            foreach (IGrouping<int, int> g in (IEnumerable)res)
-                Assert.True(g.Key == 0 || g.Key == 1);
+            foreach (IGrouping<int, int>? g in (IEnumerable)res)
+            {
+                Assert.NotNull(g);
+                Assert.True(g!.Key == 0 || g!.Key == 1);
+            }
 #pragma warning restore IDE0007 // Use implicit type
         }
 

+ 4 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToObservable.cs

@@ -194,7 +194,8 @@ namespace Tests
                 .Subscribe(new MyObserver<int>(
                     x =>
                     {
-                        subscription.Dispose();
+                        Assert.NotNull(subscription);
+                        subscription!.Dispose();
                     },
                     ex =>
                     {
@@ -242,7 +243,8 @@ namespace Tests
                 .Subscribe(new MyObserver<int>(
                     x =>
                     {
-                        subscription.Dispose();
+                        Assert.NotNull(subscription);
+                        subscription!.Dispose();
                     },
                     ex =>
                     {

+ 16 - 16
Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.cs

@@ -98,10 +98,10 @@ namespace System.Linq
         public static IOrderedAsyncEnumerable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IComparer<TKey> comparer) => ThenByAwaitCore<TSource, TKey>(source, keySelector, comparer);
         public static IOrderedAsyncEnumerable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector) => ThenByDescendingAwaitCore<TSource, TKey>(source, keySelector);
         public static IOrderedAsyncEnumerable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IComparer<TKey> comparer) => ThenByDescendingAwaitCore<TSource, TKey>(source, keySelector, comparer);
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) => ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) => ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer, cancellationToken);
         public static ValueTask<ILookup<TKey, TSource>> ToLookupAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
         public static ValueTask<ILookup<TKey, TElement>> ToLookupAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
         public static ValueTask<ILookup<TKey, TSource>> ToLookupAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
@@ -198,10 +198,10 @@ namespace System.Linq
         public static IOrderedAsyncEnumerable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IComparer<TKey> comparer) => ThenByAwaitWithCancellationCore<TSource, TKey>(source, keySelector, comparer);
         public static IOrderedAsyncEnumerable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector) => ThenByDescendingAwaitWithCancellationCore<TSource, TKey>(source, keySelector);
         public static IOrderedAsyncEnumerable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IComparer<TKey> comparer) => ThenByDescendingAwaitWithCancellationCore<TSource, TKey>(source, keySelector, comparer);
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer, cancellationToken);
         public static ValueTask<ILookup<TKey, TSource>> ToLookupAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
         public static ValueTask<ILookup<TKey, TElement>> ToLookupAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
         public static ValueTask<ILookup<TKey, TSource>> ToLookupAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
@@ -298,10 +298,10 @@ namespace System.Linq
         public static IOrderedAsyncEnumerable<TSource> ThenByAwait<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IComparer<TKey> comparer) => ThenByAwaitCore<TSource, TKey>(source, keySelector, comparer);
         public static IOrderedAsyncEnumerable<TSource> ThenByDescendingAwait<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector) => ThenByDescendingAwaitCore<TSource, TKey>(source, keySelector);
         public static IOrderedAsyncEnumerable<TSource> ThenByDescendingAwait<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IComparer<TKey> comparer) => ThenByDescendingAwaitCore<TSource, TKey>(source, keySelector, comparer);
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) => ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) => ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer, cancellationToken);
         public static ValueTask<ILookup<TKey, TSource>> ToLookupAwaitAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
         public static ValueTask<ILookup<TKey, TElement>> ToLookupAwaitAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
         public static ValueTask<ILookup<TKey, TSource>> ToLookupAwaitAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
@@ -398,10 +398,10 @@ namespace System.Linq
         public static IOrderedAsyncEnumerable<TSource> ThenByAwaitWithCancellation<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IComparer<TKey> comparer) => ThenByAwaitWithCancellationCore<TSource, TKey>(source, keySelector, comparer);
         public static IOrderedAsyncEnumerable<TSource> ThenByDescendingAwaitWithCancellation<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector) => ThenByDescendingAwaitWithCancellationCore<TSource, TKey>(source, keySelector);
         public static IOrderedAsyncEnumerable<TSource> ThenByDescendingAwaitWithCancellation<TSource, TKey>(this IOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IComparer<TKey> comparer) => ThenByDescendingAwaitWithCancellationCore<TSource, TKey>(source, keySelector, comparer);
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer, cancellationToken);
         public static ValueTask<ILookup<TKey, TSource>> ToLookupAwaitWithCancellationAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, cancellationToken);
         public static ValueTask<ILookup<TKey, TElement>> ToLookupAwaitWithCancellationAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, cancellationToken);
         public static ValueTask<ILookup<TKey, TSource>> ToLookupAwaitWithCancellationAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore<TSource, TKey>(source, keySelector, comparer, cancellationToken);

+ 4 - 2
Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.tt

@@ -109,8 +109,9 @@ foreach (var g in asyncMethods.GroupBy(m => m.Name.Contains("WithCancellation"))
         var isExtension = m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true);
         var pars = (isExtension ? "this " : "") + string.Join(", ", m.GetParameters().Select(p => toCSharp(p.ParameterType) + " " + p.Name + getOptionalSuffix(p)));
         var args = string.Join(", ", m.GetParameters().Select(p => p.Name));
+        var cons = m.Name.StartsWith("ToDictionary") ? " where TKey : notnull" : "";
 #>
-        public static <#=returnType#> <#=shortName#><#=genArgs#>(<#=pars#>) => <#=longName#><#=genArgs#>(<#=args#>);
+        public static <#=returnType#> <#=shortName#><#=genArgs#>(<#=pars#>)<#=cons#> => <#=longName#><#=genArgs#>(<#=args#>);
 <#
     }
 
@@ -143,8 +144,9 @@ foreach (var g in asyncMethods.GroupBy(m => m.Name.Contains("WithCancellation"))
         var isExtension = m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true);
         var pars = (isExtension ? "this " : "") + string.Join(", ", m.GetParameters().Select(p => toCSharp(p.ParameterType) + " " + p.Name + getOptionalSuffix(p)));
         var args = string.Join(", ", m.GetParameters().Select(p => p.Name));
+        var cons = m.Name.StartsWith("ToDictionary") ? " where TKey : notnull" : "";
 #>
-        public static <#=returnType#> <#=shortName#><#=genArgs#>(<#=pars#>) => <#=longName#><#=genArgs#>(<#=args#>);
+        public static <#=returnType#> <#=shortName#><#=genArgs#>(<#=pars#>)<#=cons#> => <#=longName#><#=genArgs#>(<#=args#>);
 <#
     }
 

+ 0 - 3
Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerablePartition.cs

@@ -25,7 +25,6 @@ namespace System.Linq
 
         internal AsyncEnumerablePartition(IAsyncEnumerable<TSource> source, int minIndexInclusive, int maxIndexInclusive)
         {
-            Debug.Assert(source != null);
             Debug.Assert(!(source is IList<TSource>), $"The caller needs to check for {nameof(IList<TSource>)}.");
             Debug.Assert(minIndexInclusive >= 0);
             Debug.Assert(maxIndexInclusive >= -1);
@@ -373,8 +372,6 @@ namespace System.Linq
 
         private static async ValueTask<uint> SkipAndCountAsync(uint index, IAsyncEnumerator<TSource> en)
         {
-            Debug.Assert(en != null);
-
             for (uint i = 0; i < index; i++)
             {
                 if (!await en.MoveNextAsync().ConfigureAwait(false))

+ 0 - 3
Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerator.cs

@@ -2,7 +2,6 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System.Diagnostics;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
@@ -67,8 +66,6 @@ namespace System.Collections.Generic
 
             public AnonymousAsyncIterator(Func<ValueTask<bool>> moveNext, Func<T> currentFunc, Func<ValueTask> dispose)
             {
-                Debug.Assert(moveNext != null);
-
                 _moveNext = moveNext;
                 _currentFunc = currentFunc;
                 _dispose = dispose;

+ 1 - 1
Ix.NET/Source/System.Linq.Async/System/Linq/AsyncListPartition.cs

@@ -24,9 +24,9 @@ namespace System.Linq
 
         public AsyncListPartition(IList<TSource> source, int minIndexInclusive, int maxIndexInclusive)
         {
-            Debug.Assert(source != null);
             Debug.Assert(minIndexInclusive >= 0);
             Debug.Assert(minIndexInclusive <= maxIndexInclusive);
+
             _source = source;
             _minIndexInclusive = minIndexInclusive;
             _maxIndexInclusive = maxIndexInclusive;

+ 1 - 1
Ix.NET/Source/System.Linq.Async/System/Linq/Maybe.cs

@@ -18,7 +18,7 @@ namespace System.Linq
         public T Value { get; }
 
         public bool Equals(Maybe<T> other) => HasValue == other.HasValue && EqualityComparer<T>.Default.Equals(Value, other.Value);
-        public override bool Equals(object other) => other is Maybe<T> m && Equals(m);
+        public override bool Equals(object? other) => other is Maybe<T> m && Equals(m);
         public override int GetHashCode() => HasValue ? EqualityComparer<T>.Default.GetHashCode(Value) : 0;
 
         public static bool operator ==(Maybe<T> first, Maybe<T> second) => first.Equals(second);

+ 0 - 2
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/AppendPrepend.cs

@@ -45,8 +45,6 @@ namespace System.Linq
 
             protected AppendPrependAsyncIterator(IAsyncEnumerable<TSource> source)
             {
-                Debug.Assert(source != null);
-
                 _source = source;
             }
 

+ 0 - 5
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Concat.cs

@@ -30,9 +30,6 @@ namespace System.Linq
 
             internal Concat2AsyncIterator(IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second)
             {
-                Debug.Assert(first != null);
-                Debug.Assert(second != null);
-
                 _first = first;
                 _second = second;
             }
@@ -195,8 +192,6 @@ namespace System.Linq
 
             internal ConcatNAsyncIterator(ConcatAsyncIterator<TSource> previousConcat, IAsyncEnumerable<TSource> next, int nextIndex)
             {
-                Debug.Assert(previousConcat != null);
-                Debug.Assert(next != null);
                 Debug.Assert(nextIndex >= 2);
 
                 _previousConcat = previousConcat;

+ 0 - 3
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/DefaultIfEmpty.cs

@@ -4,7 +4,6 @@
 
 using System.Collections;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -32,8 +31,6 @@ namespace System.Linq
 
             public DefaultIfEmptyAsyncIterator(IAsyncEnumerable<TSource> source, TSource defaultValue)
             {
-                Debug.Assert(source != null);
-
                 _source = source;
                 _defaultValue = defaultValue;
             }

+ 0 - 3
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Distinct.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -31,8 +30,6 @@ namespace System.Linq
 
             public DistinctAsyncIterator(IAsyncEnumerable<TSource> source, IEqualityComparer<TSource>? comparer)
             {
-                Debug.Assert(source != null);
-
                 _source = source;
                 _comparer = comparer;
             }

+ 0 - 22
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Lookup.cs

@@ -4,7 +4,6 @@
 
 using System.Collections;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -85,10 +84,6 @@ namespace System.Linq.Internal
 
         internal static async Task<Lookup<TKey, TElement>> CreateAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken)
         {
-            Debug.Assert(source != null);
-            Debug.Assert(keySelector != null);
-            Debug.Assert(elementSelector != null);
-
             var lookup = new Lookup<TKey, TElement>(comparer);
 
             await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false))
@@ -105,9 +100,6 @@ namespace System.Linq.Internal
 
         internal static async Task<Lookup<TKey, TElement>> CreateAsync(IAsyncEnumerable<TElement> source, Func<TElement, TKey> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken)
         {
-            Debug.Assert(source != null);
-            Debug.Assert(keySelector != null);
-
             var lookup = new Lookup<TKey, TElement>(comparer);
 
             await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false))
@@ -358,10 +350,6 @@ namespace System.Linq.Internal
 
         internal static async Task<LookupWithTask<TKey, TElement>> CreateAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken)
         {
-            Debug.Assert(source != null);
-            Debug.Assert(keySelector != null);
-            Debug.Assert(elementSelector != null);
-
             var lookup = new LookupWithTask<TKey, TElement>(comparer);
 
             await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false))
@@ -379,10 +367,6 @@ namespace System.Linq.Internal
 #if !NO_DEEP_CANCELLATION
         internal static async Task<LookupWithTask<TKey, TElement>> CreateAsync<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken)
         {
-            Debug.Assert(source != null);
-            Debug.Assert(keySelector != null);
-            Debug.Assert(elementSelector != null);
-
             var lookup = new LookupWithTask<TKey, TElement>(comparer);
 
             await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false))
@@ -400,9 +384,6 @@ namespace System.Linq.Internal
 
         internal static async Task<LookupWithTask<TKey, TElement>> CreateAsync(IAsyncEnumerable<TElement> source, Func<TElement, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken)
         {
-            Debug.Assert(source != null);
-            Debug.Assert(keySelector != null);
-
             var lookup = new LookupWithTask<TKey, TElement>(comparer);
 
             await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false))
@@ -417,9 +398,6 @@ namespace System.Linq.Internal
 #if !NO_DEEP_CANCELLATION
         internal static async Task<LookupWithTask<TKey, TElement>> CreateAsync(IAsyncEnumerable<TElement> source, Func<TElement, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken)
         {
-            Debug.Assert(source != null);
-            Debug.Assert(keySelector != null);
-
             var lookup = new LookupWithTask<TKey, TElement>(comparer);
 
             await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false))

+ 0 - 3
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Reverse.cs

@@ -4,7 +4,6 @@
 
 using System.Collections;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -29,8 +28,6 @@ namespace System.Linq
 
             public ReverseAsyncIterator(IAsyncEnumerable<TSource> source)
             {
-                Debug.Assert(source != null);
-
                 _source = source;
             }
 

+ 0 - 19
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -153,9 +152,6 @@ namespace System.Linq
 
             public SelectEnumerableAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, TResult> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -213,9 +209,6 @@ namespace System.Linq
 
             public SelectIListIterator(IList<TSource> source, Func<TSource, TResult> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -330,9 +323,6 @@ namespace System.Linq
 
             public SelectEnumerableAsyncIteratorWithTask(IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -392,9 +382,6 @@ namespace System.Linq
 
             public SelectEnumerableAsyncIteratorWithTaskAndCancellation(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -458,9 +445,6 @@ namespace System.Linq
 
             public SelectIListIteratorWithTask(IList<TSource> source, Func<TSource, ValueTask<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -580,9 +564,6 @@ namespace System.Linq
 
             public SelectIListIteratorWithTaskAndCancellation(IList<TSource> source, Func<TSource, CancellationToken, ValueTask<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }

+ 0 - 10
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -326,9 +325,6 @@ namespace System.Linq
 
             public SelectManyAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, IAsyncEnumerable<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -465,9 +461,6 @@ namespace System.Linq
 
             public SelectManyAsyncIteratorWithTask(IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<IAsyncEnumerable<TResult>>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -607,9 +600,6 @@ namespace System.Linq
 
             public SelectManyAsyncIteratorWithTaskAndCancellation(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<IAsyncEnumerable<TResult>>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }

+ 1 - 1
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToAsyncEnumerable.Observable.cs

@@ -162,7 +162,7 @@ namespace System.Linq
 
             private void DisposeSubscription() => Interlocked.Exchange(ref _subscription, null)?.Dispose();
 
-            private void OnCanceled(object state) => Dispose();
+            private void OnCanceled(object? state) => Dispose();
 
             private Task Resume()
             {

+ 0 - 7
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToAsyncEnumerable.cs

@@ -4,7 +4,6 @@
 
 using System.Collections;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -36,8 +35,6 @@ namespace System.Linq
  
             public AsyncEnumerableAdapter(IEnumerable<T> source)
             {
-                Debug.Assert(source != null);
-
                 _source = source;
             }
 
@@ -111,8 +108,6 @@ namespace System.Linq
 
             public AsyncIListEnumerableAdapter(IList<T> source)
             {
-                Debug.Assert(source != null);
-
                 _source = source;
             }
 
@@ -218,8 +213,6 @@ namespace System.Linq
 
             public AsyncICollectionEnumerableAdapter(ICollection<T> source)
             {
-                Debug.Assert(source != null);
-
                 _source = source;
             }
 

+ 12 - 12
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToDictionary.cs

@@ -10,10 +10,10 @@ namespace System.Linq
 {
     public static partial class AsyncEnumerable
     {
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, CancellationToken cancellationToken = default) =>
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, CancellationToken cancellationToken = default) where TKey : notnull =>
             ToDictionaryAsync(source, keySelector, comparer: null, cancellationToken);
 
-        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default)
+        public static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default) where TKey : notnull
         {
             if (source == null)
                 throw Error.ArgumentNull(nameof(source));
@@ -37,10 +37,10 @@ namespace System.Linq
             }
         }
 
-        internal static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsyncCore<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) =>
+        internal static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsyncCore<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) where TKey : notnull =>
             ToDictionaryAwaitAsyncCore<TSource, TKey>(source, keySelector, comparer: null, cancellationToken);
 
-        internal static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsyncCore<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default)
+        internal static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsyncCore<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default) where TKey : notnull
         {
             if (source == null)
                 throw Error.ArgumentNull(nameof(source));
@@ -65,10 +65,10 @@ namespace System.Linq
         }
 
 #if !NO_DEEP_CANCELLATION
-        internal static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) =>
+        internal static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, CancellationToken cancellationToken = default) where TKey : notnull =>
             ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, comparer: null, cancellationToken);
 
-        internal static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default)
+        internal static ValueTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default) where TKey : notnull
         {
             if (source == null)
                 throw Error.ArgumentNull(nameof(source));
@@ -93,10 +93,10 @@ namespace System.Linq
         }
 #endif
 
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, CancellationToken cancellationToken = default) =>
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull =>
             ToDictionaryAsync(source, keySelector, elementSelector, comparer: null, cancellationToken);
 
-        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default)
+        public static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default) where TKey : notnull
         {
             if (source == null)
                 throw Error.ArgumentNull(nameof(source));
@@ -123,10 +123,10 @@ namespace System.Linq
             }
         }
 
-        internal static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) =>
+        internal static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull =>
             ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer: null, cancellationToken);
 
-        internal static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default)
+        internal static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsyncCore<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, Func<TSource, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default) where TKey : notnull
         {
             if (source == null)
                 throw Error.ArgumentNull(nameof(source));
@@ -154,10 +154,10 @@ namespace System.Linq
         }
 
 #if !NO_DEEP_CANCELLATION
-        internal static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) =>
+        internal static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull =>
             ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, comparer: null, cancellationToken);
 
-        internal static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default)
+        internal static ValueTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsyncCore<TSource, TKey, TElement>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TKey>> keySelector, Func<TSource, CancellationToken, ValueTask<TElement>> elementSelector, IEqualityComparer<TKey>? comparer, CancellationToken cancellationToken = default) where TKey : notnull
         {
             if (source == null)
                 throw Error.ArgumentNull(nameof(source));

+ 1 - 3
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Union.cs

@@ -88,7 +88,7 @@ namespace System.Linq
                 while (await _enumerator!.MoveNextAsync().ConfigureAwait(false))
                 {
                     var element = _enumerator.Current;
-                    if (set.Add(element))
+                    if (set!.Add(element))
                     {
                         _current = element;
                         return true;
@@ -210,8 +210,6 @@ namespace System.Linq
             public UnionAsyncIterator2(IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource>? comparer)
                 : base(comparer)
             {
-                Debug.Assert(first != null);
-                Debug.Assert(second != null);
                 _first = first;
                 _second = second;
             }

+ 0 - 14
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -155,9 +154,6 @@ namespace System.Linq
 
             public WhereEnumerableAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(predicate != null);
-
                 _source = source;
                 _predicate = predicate;
             }
@@ -224,9 +220,6 @@ namespace System.Linq
 
             public WhereEnumerableAsyncIteratorWithTask(IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<bool>> predicate)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(predicate != null);
-
                 _source = source;
                 _predicate = predicate;
             }
@@ -289,9 +282,6 @@ namespace System.Linq
 
             public WhereEnumerableAsyncIteratorWithTaskAndCancellation(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<bool>> predicate)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(predicate != null);
-
                 _source = source;
                 _predicate = predicate;
             }
@@ -356,10 +346,6 @@ namespace System.Linq
 
             public WhereSelectEnumerableAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(predicate != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _predicate = predicate;
                 _selector = selector;

Неке датотеке нису приказане због велике количине промена