ソースを参照

Merge pull request #423 from dotnet/IxAsyncCSharp8

System.Interactive.Async with C# 8.0 proposed interfaces
Bart J.F. De Smet 7 年 前
コミット
c256fe28ef
100 ファイル変更8120 行追加23048 行削除
  1. 4 0
      .gitignore
  2. 1 0
      AUTHORS.txt
  3. 35 0
      Ix.NET/Source/.vscode/launch.json
  4. 35 0
      Ix.NET/Source/.vscode/tasks.json
  5. 17 0
      Ix.NET/Source/ApiCompare/ApiCompare.csproj
  6. 677 0
      Ix.NET/Source/ApiCompare/Program.cs
  7. 321 0
      Ix.NET/Source/AsyncQueryableGenerator.t4
  8. 1 1
      Ix.NET/Source/Benchmarks.System.Interactive/Benchmarks.System.Interactive.csproj
  9. 1 1
      Ix.NET/Source/Benchmarks.System.Interactive/Program.cs
  10. 1 0
      Ix.NET/Source/CodeCoverage.runsettings
  11. 15 11
      Ix.NET/Source/Directory.build.props
  12. 26 7
      Ix.NET/Source/Directory.build.targets
  13. 8 0
      Ix.NET/Source/FasterLinq/FasterLinq.csproj
  14. 1570 0
      Ix.NET/Source/FasterLinq/Program.cs
  15. 94 0
      Ix.NET/Source/Ix.Async.NET.sln
  16. 76 8
      Ix.NET/Source/Ix.NET.sln
  17. 21 0
      Ix.NET/Source/Playground/DemoAttribute.cs
  18. 17 0
      Ix.NET/Source/Playground/Playground.csproj
  19. 257 0
      Ix.NET/Source/Playground/Program.cs
  20. 3 8
      Ix.NET/Source/System.Interactive.Async.Providers.Tests/AssertEx.cs
  21. 786 0
      Ix.NET/Source/System.Interactive.Async.Providers.Tests/AsyncQueryableExTests.Generated.cs
  22. 484 0
      Ix.NET/Source/System.Interactive.Async.Providers.Tests/AsyncQueryableExTests.Generated.tt
  23. 1 0
      Ix.NET/Source/System.Interactive.Async.Providers.Tests/NopObserver.cs
  24. 50 0
      Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj
  25. 13 0
      Ix.NET/Source/System.Interactive.Async.Providers.Tests/ValueTaskExtensions.cs
  26. 5 0
      Ix.NET/Source/System.Interactive.Async.Providers.Tests/xunit.runner.json
  27. 0 4608
      Ix.NET/Source/System.Interactive.Async.Providers/AsyncQueryable.Generated.cs
  28. 0 277
      Ix.NET/Source/System.Interactive.Async.Providers/AsyncQueryable.Generated.tt
  29. 5 1
      Ix.NET/Source/System.Interactive.Async.Providers/Properties/AssemblyInfo.cs
  30. 0 112
      Ix.NET/Source/System.Interactive.Async.Providers/Reflection.cs
  31. 4 10
      Ix.NET/Source/System.Interactive.Async.Providers/System.Interactive.Async.Providers.csproj
  32. 1146 0
      Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.cs
  33. 16 0
      Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.tt
  34. 26 0
      Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.cs
  35. 0 639
      Ix.NET/Source/System.Interactive.Async.Tests/AppendPrependTests.cs
  36. 0 3392
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncQueryableTests.Generated.cs
  37. 0 474
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncQueryableTests.Generated.tt
  38. 0 2222
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Aggregates.cs
  39. 42 328
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs
  40. 0 591
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Conversions.cs
  41. 0 491
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Creation.cs
  42. 0 608
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Exceptions.cs
  43. 0 1062
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Multiple.cs
  44. 0 3556
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Single.cs
  45. 3 49
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.cs
  46. 30 7
      Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj
  47. 69 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/AsyncEnumerableExTests.cs
  48. 88 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Buffer.cs
  49. 300 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Catch.cs
  50. 96 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Concat.cs
  51. 41 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Defer.cs
  52. 83 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Distinct.cs
  53. 90 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/DistinctUntilChanged.cs
  54. 178 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Do.cs
  55. 67 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Expand.cs
  56. 120 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Finally.cs
  57. 77 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Generate.cs
  58. 66 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/IgnoreElements.cs
  59. 22 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/IsEmpty.cs
  60. 24 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Max.cs
  61. 76 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/MaxBy.cs
  62. 24 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Min.cs
  63. 76 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/MinBy.cs
  64. 44 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Never.cs
  65. 147 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/OnErrorResumeNext.cs
  66. 156 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Repeat.cs
  67. 59 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Retry.cs
  68. 20 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Return.cs
  69. 84 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Scan.cs
  70. 39 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/SelectMany.cs
  71. 56 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/StartWith.cs
  72. 24 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Throw.cs
  73. 196 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Using.cs
  74. 5 5
      Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs
  75. 0 152
      Ix.NET/Source/System.Interactive.Async/Aggregate.cs
  76. 0 128
      Ix.NET/Source/System.Interactive.Async/AnyAll.cs
  77. 0 505
      Ix.NET/Source/System.Interactive.Async/AppendPrepend.cs
  78. 0 93
      Ix.NET/Source/System.Interactive.Async/AsyncEnumerable.cs
  79. 0 28
      Ix.NET/Source/System.Interactive.Async/AsyncEnumerator.cs
  80. 0 141
      Ix.NET/Source/System.Interactive.Async/AsyncIterator.cs
  81. 0 815
      Ix.NET/Source/System.Interactive.Async/Average.cs
  82. 0 152
      Ix.NET/Source/System.Interactive.Async/Buffer.cs
  83. 0 38
      Ix.NET/Source/System.Interactive.Async/Cast.cs
  84. 0 256
      Ix.NET/Source/System.Interactive.Async/Catch.cs
  85. 0 63
      Ix.NET/Source/System.Interactive.Async/Contains.cs
  86. 0 125
      Ix.NET/Source/System.Interactive.Async/Count.cs
  87. 0 131
      Ix.NET/Source/System.Interactive.Async/Create.cs
  88. 0 136
      Ix.NET/Source/System.Interactive.Async/DefaultIfEmpty.cs
  89. 0 23
      Ix.NET/Source/System.Interactive.Async/Defer.cs
  90. 0 527
      Ix.NET/Source/System.Interactive.Async/Distinct.cs
  91. 0 191
      Ix.NET/Source/System.Interactive.Async/Do.cs
  92. 0 113
      Ix.NET/Source/System.Interactive.Async/ElementAt.cs
  93. 2 4
      Ix.NET/Source/System.Interactive.Async/EmptyArray.cs
  94. 0 154
      Ix.NET/Source/System.Interactive.Async/Except.cs
  95. 0 115
      Ix.NET/Source/System.Interactive.Async/Expand.cs
  96. 0 116
      Ix.NET/Source/System.Interactive.Async/Finally.cs
  97. 0 153
      Ix.NET/Source/System.Interactive.Async/First.cs
  98. 0 149
      Ix.NET/Source/System.Interactive.Async/ForEach.cs
  99. 0 101
      Ix.NET/Source/System.Interactive.Async/Generate.cs
  100. 0 171
      Ix.NET/Source/System.Interactive.Async/GroupJoin.cs

+ 4 - 0
.gitignore

@@ -117,6 +117,7 @@ stylecop.*
 artifacts/
 Generated_Code #added for RIA/Silverlight projects
 ApiApprovalTests.*.received.txt
+coverlet/
 
 # Backup & report files from converting an old project file to a newer
 # Visual Studio version. Backup files are not needed, because we have git ;-)
@@ -185,3 +186,6 @@ nuget.exe
 
 # dotnet local cache
 .dotnet
+
+# JetBrains Rider adds these
+.idea/

+ 1 - 0
AUTHORS.txt

@@ -14,6 +14,7 @@ Arthur Watson
 Gert Drapers
 Mark Shields
 Eric Rozell
+Oren Novotny
 
 Rx.js and Ix.js:
 Matthew Podwysocki

+ 35 - 0
Ix.NET/Source/.vscode/launch.json

@@ -0,0 +1,35 @@
+{
+   "version": "0.2.0",
+   "configurations": [
+        {
+            "name": ".NET Core Launch (console) - Ix.NET.sln",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build - Ix.NET.sln",
+            "program": "${workspaceFolder}/Playground/bin/Debug/netcoreapp2.1/Playground.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}/Playground",
+            "console": "internalConsole",
+            "stopAtEntry": false,
+            "internalConsoleOptions": "openOnSessionStart"
+        },
+        {
+            "name": ".NET Core Launch (console) - Ix.Async.NET.sln",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build - Ix.Async.NET.sln",
+            "program": "${workspaceFolder}/Playground/bin/Debug/netcoreapp2.1/Playground.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}/Playground",
+            "console": "internalConsole",
+            "stopAtEntry": false,
+            "internalConsoleOptions": "openOnSessionStart"
+        },
+        {
+            "name": ".NET Core Attach",
+            "type": "coreclr",
+            "request": "attach",
+            "processId": "${command:pickProcess}"
+        }
+    ,]
+}

+ 35 - 0
Ix.NET/Source/.vscode/tasks.json

@@ -0,0 +1,35 @@
+{
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "build - Ix.NET.sln",
+            "command": "dotnet",
+            "args": [
+                "build",
+                "${workspaceFolder}/Ix.NET.sln",
+                "/property:GenerateFullPaths=true"
+            ],
+            "type": "shell",
+            "group": "build",
+            "presentation": {
+                "reveal": "silent"
+            },
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "build - Ix.Async.NET.sln",
+            "command": "dotnet",
+            "args": [
+                "build",
+                "${workspaceFolder}/Ix.NET.sln",
+                "/property:GenerateFullPaths=true"
+            ],
+            "type": "shell",
+            "group": "build",
+            "presentation": {
+                "reveal": "silent"
+            },
+            "problemMatcher": "$msCompile"
+        }
+    ]
+}

+ 17 - 0
Ix.NET/Source/ApiCompare/ApiCompare.csproj

@@ -0,0 +1,17 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\System.Interactive.Async.Providers\System.Interactive.Async.Providers.csproj" />
+    <ProjectReference Include="..\System.Interactive.Async\System.Interactive.Async.csproj" />
+    <ProjectReference Include="..\System.Interactive.Providers\System.Interactive.Providers.csproj" />
+    <ProjectReference Include="..\System.Interactive\System.Interactive.csproj" />
+    <ProjectReference Include="..\System.Linq.Async.Queryable\System.Linq.Async.Queryable.csproj" />
+    <ProjectReference Include="..\System.Linq.Async\System.Linq.Async.csproj" />
+  </ItemGroup>
+
+</Project>

+ 677 - 0
Ix.NET/Source/ApiCompare/Program.cs

@@ -0,0 +1,677 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace ApiCompare
+{
+    class Program
+    {
+        private static readonly Type asyncInterfaceType = typeof(IAsyncEnumerable<>);
+        private static readonly Type syncInterfaceType = typeof(IEnumerable<>);
+
+        private static readonly Type asyncOrderedInterfaceType = typeof(IOrderedAsyncEnumerable<>);
+        private static readonly Type syncOrderedInterfaceType = typeof(IOrderedEnumerable<>);
+
+        private static readonly string[] exceptions = new[]
+        {
+            "SkipLast",  // In .NET Core 2.0
+            "TakeLast",  // In .NET Core 2.0
+
+            "ToHashSet",  // In .NET Core 2.0
+
+            "Cast",    // Non-generic methods
+            "OfType",  // Non-generic methods
+
+            "AsEnumerable",       // Trivially renamed
+            "AsAsyncEnumerable",  // Trivially renamed
+
+            "ForEachAsync",  // "foreach await" language substitute for the time being
+
+            "ToAsyncEnumerable",  // First-class conversions
+            "ToEnumerable",       // First-class conversions
+            "ToObservable",       // First-class conversions
+        };
+
+        private static readonly TypeSubstitutor subst = new TypeSubstitutor(new Dictionary<Type, Type>
+        {
+            { asyncInterfaceType, syncInterfaceType },
+            { asyncOrderedInterfaceType, syncOrderedInterfaceType },
+            { typeof(IAsyncGrouping<,>), typeof(IGrouping<,>) },
+        });
+
+        static void Main()
+        {
+            var asyncOperatorsType = typeof(AsyncEnumerable);
+            var syncOperatorsType = typeof(Enumerable);
+
+            Compare(syncOperatorsType, asyncOperatorsType);
+        }
+
+        static void Compare(Type syncOperatorsType, Type asyncOperatorsType)
+        {
+            var syncOperators = GetQueryOperators(new[] { syncInterfaceType, syncOrderedInterfaceType }, syncOperatorsType, exceptions);
+            var asyncOperators = GetQueryOperators(new[] { asyncInterfaceType, asyncOrderedInterfaceType }, asyncOperatorsType, exceptions);
+
+            CompareFactories(syncOperators.Factories, asyncOperators.Factories);
+            CompareQueryOperators(syncOperators.QueryOperators, asyncOperators.QueryOperators);
+            CompareAggregates(syncOperators.Aggregates, asyncOperators.Aggregates);
+        }
+
+        static void CompareFactories(ILookup<string, MethodInfo> syncFactories, ILookup<string, MethodInfo> asyncFactories)
+        {
+            CompareSets(syncFactories, asyncFactories, CompareFactoryOverloads);
+        }
+
+        static void CompareFactoryOverloads(string name, IEnumerable<MethodInfo> syncMethods, IEnumerable<MethodInfo> asyncMethods)
+        {
+            var sync = GetSignatures(syncMethods).ToArray();
+            var async = GetRewrittenSignatures(asyncMethods).ToArray();
+
+            //
+            // Ensure that async is a superset of sync.
+            //
+
+            var notInAsync = sync.Except(async);
+
+            if (notInAsync.Any())
+            {
+                foreach (var signature in notInAsync)
+                {
+                    Console.WriteLine("MISSING " + ToString(signature.Method));
+                }
+            }
+
+            //
+            // Check for excess overloads.
+            //
+
+            var notInSync = async.Except(sync);
+
+            if (notInSync.Any())
+            {
+                foreach (var signature in notInSync)
+                {
+                    Console.WriteLine("EXCESS " + ToString(signature.Method));
+                }
+            }
+        }
+
+        static void CompareQueryOperators(ILookup<string, MethodInfo> syncOperators, ILookup<string, MethodInfo> asyncOperators)
+        {
+            CompareSets(syncOperators, asyncOperators, CompareQueryOperatorsOverloads);
+        }
+
+        static void CompareQueryOperatorsOverloads(string name, IEnumerable<MethodInfo> syncMethods, IEnumerable<MethodInfo> asyncMethods)
+        {
+            var sync = GetSignatures(syncMethods).ToArray();
+            var async = GetRewrittenSignatures(asyncMethods).ToArray();
+
+            //
+            // Ensure that async is a superset of sync.
+            //
+
+            var notInAsync = sync.Except(async);
+
+            if (notInAsync.Any())
+            {
+                foreach (var signature in notInAsync)
+                {
+                    Console.WriteLine("MISSING " + ToString(signature.Method));
+                }
+            }
+
+            //
+            // Find Task-based overloads.
+            //
+
+            var taskBasedSignatures = new List<Signature>();
+
+            foreach (var signature in sync)
+            {
+                if (signature.ParameterTypes.Any(IsFuncOrActionType))
+                {
+                    taskBasedSignatures.Add(GetAsyncVariant(signature));
+                }
+            }
+
+            if (taskBasedSignatures.Count > 0)
+            {
+                var notInAsyncTaskBased = taskBasedSignatures.Except(async);
+
+                if (notInAsyncTaskBased.Any())
+                {
+                    foreach (var signature in notInAsyncTaskBased)
+                    {
+                        Console.WriteLine("MISSING " + name + " :: " + signature);
+                    }
+                }
+            }
+
+            //
+            // Excess overloads that are neither carbon copies of sync nor Task-based variants of sync.
+            //
+
+            var notInSync = async.Except(sync.Union(taskBasedSignatures));
+
+            if (notInSync.Any())
+            {
+                foreach (var signature in notInSync)
+                {
+                    Console.WriteLine("EXCESS " + ToString(signature.Method));
+                }
+            }
+        }
+
+        static void CompareAggregates(ILookup<string, MethodInfo> syncAggregates, ILookup<string, MethodInfo> asyncAggregates)
+        {
+            CompareSets(syncAggregates, asyncAggregates, CompareAggregateOverloads);
+        }
+
+        static void CompareAggregateOverloads(string name, IEnumerable<MethodInfo> syncMethods, IEnumerable<MethodInfo> asyncMethods)
+        {
+            var sync = GetSignatures(syncMethods).Select(GetAsyncAggregateSignature).ToArray();
+            var async = GetRewrittenSignatures(asyncMethods).ToArray();
+
+            //
+            // Ensure that async is a superset of sync.
+            //
+
+            var notInAsync = sync.Except(async);
+
+            if (notInAsync.Any())
+            {
+                foreach (var signature in notInAsync)
+                {
+                    Console.WriteLine("MISSING " + ToString(signature.Method));
+                }
+            }
+
+            //
+            // Find Task-based overloads.
+            //
+
+            var taskBasedSignatures = new List<Signature>();
+
+            foreach (var signature in sync)
+            {
+                if (signature.ParameterTypes.Any(IsFuncOrActionType))
+                {
+                    taskBasedSignatures.Add(GetAsyncVariant(signature));
+                }
+            }
+
+            if (taskBasedSignatures.Count > 0)
+            {
+                var notInAsyncTaskBased = taskBasedSignatures.Except(async);
+
+                if (notInAsyncTaskBased.Any())
+                {
+                    foreach (var signature in notInAsyncTaskBased)
+                    {
+                        Console.WriteLine("MISSING " + name + " :: " + signature);
+                    }
+                }
+            }
+
+            //
+            // Check for overloads with CancellationToken.
+            //
+
+            var withCancellationToken = new List<Signature>();
+
+            foreach (var signature in sync)
+            {
+                withCancellationToken.Add(AppendCancellationToken(signature));
+            }
+
+            foreach (var signature in taskBasedSignatures)
+            {
+                withCancellationToken.Add(AppendCancellationToken(signature));
+            }
+
+            var notInAsyncWithCancellationToken = withCancellationToken.Except(async);
+
+            if (notInAsyncWithCancellationToken.Any())
+            {
+                foreach (var signature in notInAsyncWithCancellationToken)
+                {
+                    Console.WriteLine("MISSING " + name + " :: " + signature);
+                }
+            }
+
+            //
+            // Excess overloads that are neither carbon copies of sync nor Task-based variants of sync.
+            //
+
+            var notInSync = async.Except(sync.Union(taskBasedSignatures).Union(withCancellationToken));
+
+            if (notInSync.Any())
+            {
+                foreach (var signature in notInSync)
+                {
+                    Console.WriteLine("EXCESS " + ToString(signature.Method));
+                }
+            }
+        }
+
+        private static bool IsFuncOrActionType(Type type)
+        {
+            if (type.IsConstructedGenericType)
+            {
+                var defName = type.GetGenericTypeDefinition().Name;
+                return defName.StartsWith("Func`") || defName.StartsWith("Action`");
+            }
+
+            if (type == typeof(Action))
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        private static Signature GetAsyncVariant(Signature signature)
+        {
+            return new Signature
+            {
+                ParameterTypes = signature.ParameterTypes.Select(GetAsyncVariant).ToArray(),
+                ReturnType = signature.ReturnType
+            };
+        }
+
+        private static Signature AppendCancellationToken(Signature signature)
+        {
+            return new Signature
+            {
+                ParameterTypes = signature.ParameterTypes.Concat(new[] { typeof(CancellationToken) }).ToArray(),
+                ReturnType = signature.ReturnType
+            };
+        }
+
+        private static Type GetAsyncVariant(Type type)
+        {
+            if (IsFuncOrActionType(type))
+            {
+                if (type == typeof(Action))
+                {
+                    return typeof(Func<Task>);
+                }
+                else
+                {
+                    var args = type.GetGenericArguments();
+
+                    var defName = type.GetGenericTypeDefinition().Name;
+                    if (defName.StartsWith("Func`"))
+                    {
+                        var ret = typeof(Task<>).MakeGenericType(args.Last());
+
+                        return Expression.GetFuncType(Enumerable.SkipLast(args, 1).Append(ret).ToArray());
+                    }
+                    else
+                    {
+                        return Expression.GetFuncType(args.Append(typeof(Task)).ToArray());
+                    }
+                }
+            }
+
+            return type;
+        }
+
+        static void CompareSets(ILookup<string, MethodInfo> sync, ILookup<string, MethodInfo> async, Action<string, IEnumerable<MethodInfo>, IEnumerable<MethodInfo>> compareCore)
+        {
+            var syncNames = sync.Select(g => g.Key).ToArray();
+            var asyncNames = async.Select(g => g.Key).ToArray();
+
+            //
+            // Analyze that async is a superset of sync.
+            //
+
+            var notInAsync = syncNames.Except(asyncNames);
+
+            foreach (var n in notInAsync)
+            {
+                foreach (var o in sync[n])
+                {
+                    Console.WriteLine("MISSING " + ToString(o));
+                }
+            }
+
+            //
+            // Need to find the same overloads.
+            //
+
+            var inBoth = syncNames.Intersect(asyncNames);
+
+            foreach (var n in inBoth)
+            {
+                var s = sync[n];
+                var a = async[n];
+
+                compareCore(n, s, a);
+            }
+
+            //
+            // Report excessive API surface.
+            //
+
+            var onlyInAsync = asyncNames.Except(syncNames);
+
+            foreach (var n in onlyInAsync)
+            {
+                foreach (var o in async[n])
+                {
+                    Console.WriteLine("EXCESS " + ToString(o));
+                }
+            }
+        }
+
+        static Operators GetQueryOperators(Type[] interfaceTypes, Type operatorsType, string[] exclude)
+        {
+            //
+            // Get all the static methods.
+            //
+
+            var methods = operatorsType.GetMethods(BindingFlags.Public | BindingFlags.Static).Where(m => !exclude.Contains(m.Name));
+
+            //
+            // Get extension methods. These can be either operators or aggregates.
+            //
+
+            var extensionMethods = methods.Where(m => m.IsDefined(typeof(ExtensionAttribute))).ToArray();
+
+            //
+            // Static methods that aren't extension methods can be factories.
+            //
+
+            var factories = methods.Except(extensionMethods).Where(m => m.ReturnType.IsConstructedGenericType && interfaceTypes.Contains(m.ReturnType.GetGenericTypeDefinition())).ToArray();
+
+            //
+            // Extension methods that return the interface type are operators.
+            //
+
+            var queryOperators = extensionMethods.Where(m => m.ReturnType.IsConstructedGenericType && interfaceTypes.Contains(m.ReturnType.GetGenericTypeDefinition())).ToArray();
+
+            //
+            // Extension methods that return another type are aggregates.
+            //
+
+            var aggregates = extensionMethods.Except(queryOperators).ToArray();
+
+            //
+            // Return operators.
+            //
+
+            return new Operators
+            {
+                Factories = factories.ToLookup(m => m.Name, m => m),
+                QueryOperators = queryOperators.ToLookup(m => m.Name, m => m),
+                Aggregates = aggregates.ToLookup(m => m.Name, m => m),
+            };
+        }
+
+        static IEnumerable<Signature> GetSignatures(IEnumerable<MethodInfo> methods)
+        {
+            return methods.Select(m => GetSignature(m));
+        }
+
+        static IEnumerable<Signature> GetRewrittenSignatures(IEnumerable<MethodInfo> methods)
+        {
+            return GetSignatures(methods).Select(s => RewriteSignature(s));
+        }
+
+        static Signature GetSignature(MethodInfo method)
+        {
+            if (method.IsGenericMethodDefinition)
+            {
+                var newArgs = method.GetGenericArguments().Select((t, i) => Wildcards[i]).ToArray();
+                method = method.MakeGenericMethod(newArgs);
+            }
+
+            return new Signature
+            {
+                Method = method,
+                ReturnType = method.ReturnType,
+                ParameterTypes = method.GetParameters().Select(p => p.ParameterType).ToArray()
+            };
+        }
+
+        static Signature RewriteSignature(Signature signature)
+        {
+            return new Signature
+            {
+                Method = signature.Method,
+                ReturnType = subst.Visit(signature.ReturnType),
+                ParameterTypes = subst.Visit(signature.ParameterTypes)
+            };
+        }
+
+        static Signature GetAsyncAggregateSignature(Signature signature)
+        {
+            var retType = signature.ReturnType == typeof(void) ? typeof(Task) : typeof(Task<>).MakeGenericType(signature.ReturnType);
+
+            return new Signature
+            {
+                Method = signature.Method,
+                ReturnType = retType,
+                ParameterTypes = signature.ParameterTypes
+            };
+        }
+
+        static string ToString(MethodInfo method)
+        {
+            if (method == null)
+            {
+                return "UNKNOWN";
+            }
+
+            if (method.IsGenericMethod && !method.IsGenericMethodDefinition)
+            {
+                method = method.GetGenericMethodDefinition();
+            }
+
+            return method.ToString();
+        }
+
+        class Operators
+        {
+            public ILookup<string, MethodInfo> Factories;
+            public ILookup<string, MethodInfo> QueryOperators;
+            public ILookup<string, MethodInfo> Aggregates;
+        }
+
+        class Signature : IEquatable<Signature>
+        {
+            public MethodInfo Method;
+            public Type ReturnType;
+            public Type[] ParameterTypes;
+
+            public static bool operator ==(Signature s1, Signature s2)
+            {
+                if ((object)s1 == null && (object)s2 == null)
+                {
+                    return true;
+                }
+
+                if ((object)s1 == null || (object)s2 == null)
+                {
+                    return false;
+                }
+
+                return s1.Equals(s2);
+            }
+
+            public static bool operator !=(Signature s1, Signature s2)
+            {
+                return !(s1 == s2);
+            }
+
+            public bool Equals(Signature s)
+            {
+                return (object)s != null && ReturnType.Equals(s.ReturnType) && ParameterTypes.SequenceEqual(s.ParameterTypes);
+            }
+
+            public override bool Equals(object obj)
+            {
+                if (obj is Signature s)
+                {
+                    return Equals(s);
+                }
+
+                return false;
+            }
+
+            public override int GetHashCode()
+            {
+                return ParameterTypes.Concat(new[] { ReturnType }).Aggregate(0, (a, t) => a * 17 + t.GetHashCode());
+            }
+
+            public override string ToString()
+            {
+                return "(" + string.Join(", ", ParameterTypes.Select(t => t.ToCSharp())) + ") -> " + ReturnType.ToCSharp();
+            }
+        }
+
+        class TypeVisitor
+        {
+            public virtual Type Visit(Type type)
+            {
+                if (type.IsArray)
+                {
+                    if (type.GetElementType().MakeArrayType() == type)
+                    {
+                        return VisitArray(type);
+                    }
+                    else
+                    {
+                        return VisitMultidimensionalArray(type);
+                    }
+                }
+                else if (type.GetTypeInfo().IsGenericTypeDefinition)
+                {
+                    return VisitGenericTypeDefinition(type);
+                }
+                else if (type.IsConstructedGenericType)
+                {
+                    return VisitGeneric(type);
+                }
+                else if (type.IsByRef)
+                {
+                    return VisitByRef(type);
+                }
+                else if (type.IsPointer)
+                {
+                    return VisitPointer(type);
+                }
+                else
+                {
+                    return VisitSimple(type);
+                }
+            }
+
+            protected virtual Type VisitArray(Type type)
+            {
+                return Visit(type.GetElementType()).MakeArrayType();
+            }
+
+            protected virtual Type VisitMultidimensionalArray(Type type)
+            {
+                return Visit(type.GetElementType()).MakeArrayType(type.GetArrayRank());
+            }
+
+            protected virtual Type VisitGenericTypeDefinition(Type type)
+            {
+                return type;
+            }
+
+            protected virtual Type VisitGeneric(Type type)
+            {
+                return Visit(type.GetGenericTypeDefinition()).MakeGenericType(Visit(type.GenericTypeArguments));
+            }
+
+            protected virtual Type VisitByRef(Type type)
+            {
+                return Visit(type.GetElementType()).MakeByRefType();
+            }
+
+            protected virtual Type VisitPointer(Type type)
+            {
+                return Visit(type.GetElementType()).MakePointerType();
+            }
+
+            protected virtual Type VisitSimple(Type type)
+            {
+                return type;
+            }
+
+            public Type[] Visit(Type[] types)
+            {
+                return types.Select(Visit).ToArray();
+            }
+        }
+
+        class TypeSubstitutor : TypeVisitor
+        {
+            private readonly Dictionary<Type, Type> map;
+
+            public TypeSubstitutor(Dictionary<Type, Type> map)
+            {
+                this.map = map;
+            }
+
+            public override Type Visit(Type type)
+            {
+                if (map.TryGetValue(type, out var subst))
+                {
+                    return subst;
+                }
+
+                return base.Visit(type);
+            }
+        }
+
+        private static readonly Type[] Wildcards = new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4) };
+
+        class T1 { }
+        class T2 { }
+        class T3 { }
+        class T4 { }
+    }
+
+    static class TypeExtensions
+    {
+        public static string ToCSharp(this Type type)
+        {
+            if (type.IsArray)
+            {
+                if (type.GetElementType().MakeArrayType() == type)
+                {
+                    return type.GetElementType().ToCSharp() + "[]";
+                }
+                else
+                {
+                    return type.GetElementType().ToCSharp() + "[" + new string(',', type.GetArrayRank() - 1) + "]";
+                }
+            }
+            else if (type.IsConstructedGenericType)
+            {
+                var def = type.GetGenericTypeDefinition();
+                var defName = def.Name.Substring(0, def.Name.IndexOf('`'));
+
+                return defName + "<" + string.Join(", ", type.GetGenericArguments().Select(ToCSharp)) + ">";
+            }
+            else
+            {
+                return type.Name;
+            }
+        }
+    }
+}

+ 321 - 0
Ix.NET/Source/AsyncQueryableGenerator.t4

@@ -0,0 +1,321 @@
+<#@ assembly name="System.Core" #>
+<#@ assembly name="System.Runtime" #>
+<#@ import namespace="System.Linq" #>
+<#@ import namespace="System.Text" #>
+<#@ import namespace="System.Threading" #>
+<#@ import namespace="System.Threading.Tasks" #>
+<#@ import namespace="System.Collections.Generic" #>
+<#
+var infoFieldNames = new Dictionary<string, int>();
+
+var toQuotedImpl = default(Func<Type, int, bool, string>);
+toQuotedImpl = (t, i, b) =>
+{
+var name = t.Name;
+
+if (t.IsGenericType)
+{
+    var genDef = t.GetGenericTypeDefinition();
+    name = genDef.Name.Substring(0, genDef.Name.LastIndexOf('`'));
+
+    var genArgs = "<" + string.Join(", ", t.GetGenericArguments().Select(a => toQuotedImpl(a, i, false))) + ">";
+
+    if (b)
+    {
+        if (name == "Func" || name == "Action")
+        {
+            name = "Expression<" + name + genArgs + ">";
+        }
+        else if (name == "IAsyncEnumerable" && i == 0)
+        {
+            name = "IAsyncQueryable" + genArgs;
+        }
+        else if (name == "IOrderedAsyncEnumerable" && i == 0)
+        {
+            name = "IOrderedAsyncQueryable" + genArgs;
+        }
+        else
+        {
+            name += genArgs;
+        }
+    }
+    else
+    {
+        if (name == "Nullable")
+        {
+            name = genArgs.Substring(1, genArgs.Length - 2) + "?";
+        }
+        else
+        {
+            name += genArgs;
+        }
+    }
+}
+else if (t.IsArray)
+{
+    var elem = toQuotedImpl(t.GetElementType(), i, b);
+    name = elem + "[]";
+}
+else
+{
+    if (t == typeof(int))
+    {
+        name = "int";
+    }
+    else if (t == typeof(long))
+    {
+        name = "long";
+    }
+    else if (t == typeof(float))
+    {
+        name = "float";
+    }
+    else if (t == typeof(double))
+    {
+        name = "double";
+    }
+    else if (t == typeof(decimal))
+    {
+        name = "decimal";
+    }
+    else if (t == typeof(bool))
+    {
+        name = "bool";
+    }
+    else if (t == typeof(object))
+    {
+        name = "object";
+    }
+}
+
+return name;
+};
+
+var toQuoted = new Func<Type, int, string>((t, i) => toQuotedImpl(t, i, true));
+#>
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace System.Linq
+{
+    public static partial class <#=className#>
+    {
+<#
+// NOTE: Just including extension methods
+foreach (var m in asyncEnumerableType.GetMethods()
+                        .Where(m => m.IsStatic)
+                        .Where(m => !exclude.Contains(m.Name))
+                        .Where(m => m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))
+                        .Where(m =>
+                        {
+                            var p0 = m.GetParameters()[0].ParameterType;
+                            if (p0.IsGenericType)
+                            {
+                                var p0d = p0.GetGenericTypeDefinition();
+                                return p0d == typeof(IAsyncEnumerable<>) || p0d == typeof(IOrderedAsyncEnumerable<>);
+                            }
+
+                            return false;
+                        })
+                        .OrderBy(m => m.Name)
+                        .ThenBy(m => m.IsGenericMethod ? m.GetGenericArguments().Length : 0)
+                        .ThenBy(m => m.GetParameters().Length)
+                        .ThenBy(m => string.Join(", ", m.GetParameters().Select((p, i) => toQuoted(p.ParameterType, i) + " " + p.Name))))
+{
+    var genArgs = m.GetGenericArguments();
+
+    var ret = toQuoted(m.ReturnType, 0);
+    var name = m.Name;
+
+    if (genArgs.Length > 0)
+    {
+        name += "<" + string.Join(", ", genArgs.Select(a => a.Name)) + ">";
+    }
+
+    var isParams = false;
+    var lastParameterDefault = false;
+    var parCount = m.GetParameters().Length;
+
+    if (parCount != 0)
+    {
+        var lastParam = m.GetParameters().Last();
+
+        if (lastParam.IsDefined(typeof(ParamArrayAttribute), true))
+        {
+            isParams = true;
+        }
+
+        if (lastParam.ParameterType == typeof(CancellationToken))
+        {
+            lastParameterDefault = true;
+        }
+    }
+
+    var pars = string.Join(", ", m.GetParameters().Select((p, i) => (i == parCount - 1 && isParams ? "params " : "") + toQuoted(p.ParameterType, i) + " " + p.Name + (i == parCount - 1 && lastParameterDefault ? " = default" : "")));
+    var quotedPars = string.Join(", ", m.GetParameters().Select((p, i) => "default(" + toQuoted(p.ParameterType, i) + ")"));
+
+    if (m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))
+    {
+        pars = "this " + pars;
+    }
+
+    var infoName = m.Name;
+    var infoTypeArgs = "";
+    var infoToGeneric = "";
+    var infoMakeGeneric = "";
+    var infoGenArgs = "";
+
+    if (genArgs.Length > 0)
+    {
+        infoName += "__" + string.Join("_", genArgs.Select(a => a.Name));
+        infoTypeArgs = "(" + string.Join(", ", genArgs.Select(a => "Type " + a.Name)) + ")";
+        infoToGeneric = ".GetGenericMethodDefinition()";
+        infoMakeGeneric = ".MakeGenericMethod(" + string.Join(", ", genArgs.Select(a => a.Name)) + ")";
+        infoGenArgs = "<" + string.Join(", ", genArgs.Select(_ => "object")) + ">";
+    }
+
+    infoName += "__" + parCount + "__";
+
+    int infoNameCount;
+    if (!infoFieldNames.TryGetValue(infoName, out infoNameCount))
+    {
+        infoNameCount = 0;
+    }
+
+    var infoNameId = infoNameCount++;
+
+    infoFieldNames[infoName] = infoNameCount;
+
+    infoName += infoNameId;
+
+    var infoSignature = string.Join(", ", m.GetParameters().Select((p, i) => toQuoted(p.ParameterType, i)).Concat(new[] { toQuoted(m.ReturnType, 0) }));
+
+    foreach (var genArg in genArgs)
+    {
+        infoSignature = infoSignature.Replace(genArg.Name, "object");
+    }
+
+    var mtd = infoName;
+
+    if (m.IsGenericMethod)
+    {
+        mtd += "(" + string.Join(", ", genArgs.Select(a => "typeof(" + a.Name + ")")) + ")";
+    }
+
+    var provider = m.GetParameters()[0].Name + ".Provider";
+    var factory = "";
+    var rem = "";
+    var cast = "";
+    var quotedArgs = new List<string>();
+
+    if (m.ReturnType.IsGenericType)
+    {
+        var td = m.ReturnType.GetGenericTypeDefinition();
+
+        if (td.Name.EndsWith("Task`1")) // NB: Covers Task and ValueTask
+        {
+            factory = "ExecuteAsync<" + toQuotedImpl(m.ReturnType.GetGenericArguments()[0], -1, false) + ">";
+
+            var last = m.GetParameters().Last();
+            if (last.ParameterType == typeof(CancellationToken))
+            {
+                rem = ", " + last.Name;
+            }
+            else
+            {
+                rem = ", CancellationToken.None";
+            }
+        }
+        else if (td == typeof(IAsyncEnumerable<>) || td == typeof(IOrderedAsyncEnumerable<>))
+        {
+            factory = "CreateQuery<" + toQuotedImpl(m.ReturnType.GetGenericArguments()[0], -1, false) + ">";
+
+            if (td == typeof(IOrderedAsyncEnumerable<>))
+            {
+                cast = "(" + toQuoted(m.ReturnType, 0) + ")";
+            }
+        }
+    }
+
+    var n = 0;
+    foreach (var p in m.GetParameters())
+    {
+        var pt = p.ParameterType;
+
+        var add = false;
+
+        if (pt.IsGenericType)
+        {
+            var ptd = pt.GetGenericTypeDefinition();
+
+            if (ptd == typeof(IAsyncEnumerable<>) || ptd == typeof(IOrderedAsyncEnumerable<>))
+            {
+                if (n == 0)
+                {
+                    quotedArgs.Add(p.Name + ".Expression");
+                }
+                else
+                {
+                    quotedArgs.Add("GetSourceExpression(" + p.Name + ")");
+                }
+                add = true;
+            }
+            else if (ptd.Name.StartsWith("Func") || ptd.Name.StartsWith("Action"))
+            {
+                quotedArgs.Add(p.Name);
+                add = true;
+            }
+        }
+        
+        if (!add)
+        {
+            quotedArgs.Add("Expression.Constant(" + p.Name + ", typeof(" + toQuoted(pt, -1) + "))");
+        }
+
+        n++;
+    }
+
+    var expr = "Expression.Call(" + mtd + ", " + string.Join(", ", quotedArgs) + ")";
+#>
+        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#>)
+        {
+<#
+var any = false;
+foreach (var p in m.GetParameters())
+{
+    if (!p.ParameterType.IsValueType && !p.ParameterType.IsGenericParameter && !nullableParameterNames.Contains(p.Name))
+    {
+        any = true;
+#>
+            if (<#=p.Name#> == null)
+                throw new ArgumentNullException(nameof(<#=p.Name#>));
+<#
+    }
+}
+#>
+<#
+if (any)
+{
+#>
+
+<#
+}
+
+#>
+            return <#=cast#><#=provider#>.<#=factory#>(<#=expr#><#=rem#>);
+        }
+
+<#
+}
+#>
+    }
+}

+ 1 - 1
Ix.NET/Source/Benchmarks.System.Interactive/Benchmarks.System.Interactive.csproj

@@ -20,7 +20,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="BenchmarkDotNet" Version="0.10.14" />
+    <PackageReference Include="BenchmarkDotNet" Version="0.11.4" />
   </ItemGroup>
 
   <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Ix.net 3.1.1|AnyCPU'">

+ 1 - 1
Ix.NET/Source/Benchmarks.System.Interactive/Program.cs

@@ -21,7 +21,7 @@ namespace Benchmarks.System.Interactive
                 typeof(IgnoreElementsBenchmark),
                 typeof(DeferBenchmark),
                 typeof(RetryBenchmark),
-                typeof(MinMaxBenchmark),
+                typeof(MinMaxBenchmark)
             });
 
             switcher.Run();

+ 1 - 0
Ix.NET/Source/CodeCoverage.runsettings

@@ -19,6 +19,7 @@ Included items must then not match any entries in the exclude list to remain inc
             <ModulePaths>
               <Include>
                 <ModulePath>.*Interactive.*</ModulePath>
+                <ModulePath>.*System.Linq.Async.dll$</ModulePath>
               </Include>
               <Exclude>
                 <ModulePath>.*Tests.dll$</ModulePath>

+ 15 - 11
Ix.NET/Source/Directory.build.props

@@ -1,30 +1,34 @@
-<Project>  
-  
+<Project>
   <PropertyGroup>
     <Copyright>Copyright (c) .NET Foundation and Contributors.</Copyright>
     <MinClientVersion>2.12</MinClientVersion>
     <GenerateDocumentationFile>true</GenerateDocumentationFile>
     <Authors>.NET Foundation and Contributors</Authors>
-    <PackageIconUrl>http://go.microsoft.com/fwlink/?LinkId=261274</PackageIconUrl>
+    <PackageIconUrl>https://raw.githubusercontent.com/dotnet/reactive/0f837d11385cfaf575861ccc5a5fbcafb22d888f/Rx.NET/Resources/Artwork/Logo.png</PackageIconUrl>
     <PackageProjectUrl>https://github.com/dotnet/reactive</PackageProjectUrl>
-    <PackageLicenseUrl>https://raw.githubusercontent.com/Reactive-Extensions/Rx.NET/master/Ix.NET/Source/license.txt</PackageLicenseUrl>
-    <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>    
+    <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
+    <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
     <SignAssembly>true</SignAssembly>
     <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)ReactiveX.snk</AssemblyOriginatorKeyFile>
     <NoWarn>$(NoWarn);1701;1702;CS1591;NU5105</NoWarn>
     <DefaultLanguage>en-US</DefaultLanguage>
     <IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
-    <DebugType>embedded</DebugType>
+    <DebugType Condition="'$(Configuration)' != 'Debug'">embedded</DebugType>
     <EmbedUntrackedSources>true</EmbedUntrackedSources>
     <PublishRepositoryUrl>true</PublishRepositoryUrl>
-    <LangVersion>latest</LangVersion>
+    <!-- While in beta, we need to set 8.0 manually (rather than latest). -->
+    <LangVersion>8.0</LangVersion>
   </PropertyGroup>
-    
+
   <ItemGroup>
-    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All"/>
-    <PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
+    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All"/>
+    <PackageReference Include="Nerdbank.GitVersioning" Version="2.3.105" PrivateAssets="all" />
+  </ItemGroup>
+
+  <ItemGroup Condition="'$(IsTestProject)' == 'true'">
+    <PackageReference Include="coverlet.msbuild" Version="2.5.1" />
   </ItemGroup>
-  
+
   <Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
     <ItemGroup>
       <AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition=" '$(SourceRevisionId)' != '' ">

+ 26 - 7
Ix.NET/Source/Directory.build.targets

@@ -1,18 +1,37 @@
-<Project>  
-  
+<Project>
+
   <!-- This props all need to be set in targets as they depend on the values set earlier -->
   <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.0'">
-    <DefineConstants>$(DefineConstants);NO_ARRAY_EMPTY;NO_CODE_COVERAGE_ATTRIBUTE;CRIPPLED_REFLECTION</DefineConstants>
+    <DefineConstants>$(DefineConstants);NO_ARRAY_EMPTY;NO_CODE_COVERAGE_ATTRIBUTE</DefineConstants>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
-    <DefineConstants>$(DefineConstants);NO_CODE_COVERAGE_ATTRIBUTE;CRIPPLED_REFLECTION</DefineConstants>
+  <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.4'">
+    <DefineConstants>$(DefineConstants);NO_CODE_COVERAGE_ATTRIBUTE</DefineConstants>
   </PropertyGroup>
   <PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
-    <DefineConstants>$(DefineConstants);NO_ARRAY_EMPTY</DefineConstants>
+    <DefineConstants>$(DefineConstants);NO_ARRAY_EMPTY;NO_TASK_FROMEXCEPTION</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
+    <DefineConstants>$(DefineConstants);USE_ASYNC_ITERATOR</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0' or '$(TargetFramework)' == 'netstandard2.1'">
+    <DefineConstants>$(DefineConstants);USE_ASYNC_ITERATOR;HAS_ASYNCENUMERABLE;HAS_ASYNCDISPOSABLE;BCL_HAS_CONFIGUREAWAIT;HAS_VALUETUPLE</DefineConstants>
   </PropertyGroup>
 
   <PropertyGroup>
     <Product>$(AssemblyName) ($(TargetFramework))</Product>
   </PropertyGroup>
+  
+  <ItemGroup>
+    <!-- Workaround https://github.com/dotnet/sdk/issues/2976 -->
+    <PackageReference Update="Microsoft.NETCore.Platforms" PrivateAssets="All" />
+  </ItemGroup>
+  
+  <PropertyGroup Condition="'$(IsTestProject)' == 'true'">
+    <UseSourceLink>true</UseSourceLink>
+    <CoverletOutputFormat>cobertura</CoverletOutputFormat>
+    <Exclude>[xunit.*]*</Exclude>
+    <CoverletOutput>$(MSBuildThisFileDirectory)coverlet/raw/$(AssemblyName)/$(TargetFramework)/</CoverletOutput>
+    <CollectCoverage Condition="'$(TF_BUILD)' == 'true'">true</CollectCoverage>
+  </PropertyGroup>
 
-</Project>
+</Project>

+ 8 - 0
Ix.NET/Source/FasterLinq/FasterLinq.csproj

@@ -0,0 +1,8 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
+  </PropertyGroup>
+
+</Project>

+ 1570 - 0
Ix.NET/Source/FasterLinq/Program.cs

@@ -0,0 +1,1570 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Labs.Linq;
+using System.Threading.Tasks;
+
+namespace FasterLinq
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            var N = 4;
+
+            Sync(N);
+            Async1(N).Wait();
+            Async2(N).Wait();
+        }
+
+        static void Sync(int n)
+        {
+            Console.WriteLine("IEnumerable<T> and IFastEnumerable<T>");
+            Console.WriteLine();
+
+            var sw = new Stopwatch();
+
+            var N = 10_000_000;
+
+            var next = new Action<int>(_ => { });
+
+            var slowRange = Enumerable.Range(0, N);
+            var fastRange = FastEnumerable.Range(0, N);
+            var brdgRange = slowRange.ToFastEnumerable();
+
+            var slow = slowRange.Where(x => x % 2 == 0).Select(x => x + 1);
+            var fast = fastRange.Where(x => x % 2 == 0).Select(x => x + 1);
+            var brdg = brdgRange.Where(x => x % 2 == 0).Select(x => x + 1).ToEnumerable();
+
+            Console.WriteLine("slow.Sum() = " + slow.Aggregate(0, (sum, x) => sum + x));
+            Console.WriteLine("fast.Sum() = " + fast.Aggregate(0, (sum, x) => sum + x));
+            Console.WriteLine("brdg.Sum() = " + brdg.Aggregate(0, (sum, x) => sum + x));
+            Console.WriteLine();
+
+            for (var i = 0; i < n; i++)
+            {
+                sw.Restart();
+                {
+                    slow.ForEach(next);
+                }
+                Console.WriteLine("SLOW " + sw.Elapsed);
+
+                sw.Restart();
+                {
+                    fast.ForEach(next);
+                }
+                Console.WriteLine("FAST " + sw.Elapsed);
+
+                sw.Restart();
+                {
+                    brdg.ForEach(next);
+                }
+                Console.WriteLine("BRDG " + sw.Elapsed);
+
+                Console.WriteLine();
+            }
+
+            Console.WriteLine();
+        }
+
+        static async Task Async1(int n)
+        {
+            Console.WriteLine("IAsyncEnumerable<T> and IAsyncFastEnumerable<T> - Synchronous query operators");
+            Console.WriteLine();
+
+            var sw = new Stopwatch();
+
+            var N = 10_000_000;
+
+            var next = new Func<int, Task>(_ => Task.CompletedTask);
+
+            var slowRange = AsyncEnumerable.Range(0, N);
+            var fastRange = AsyncFastEnumerable.Range(0, N);
+            var brdgRange = slowRange.ToAsyncFastEnumerable();
+
+            var slow = slowRange.Where(x => x % 2 == 0).Select(x => x + 1);
+            var fast = fastRange.Where(x => x % 2 == 0).Select(x => x + 1);
+            var brdg = brdgRange.Where(x => x % 2 == 0).Select(x => x + 1).ToAsyncEnumerable();
+
+            Console.WriteLine("slow.Sum() = " + slow.Aggregate(0, (sum, x) => sum + x).Result);
+            Console.WriteLine("fast.Sum() = " + fast.Aggregate(0, (sum, x) => sum + x).Result);
+            Console.WriteLine("brdg.Sum() = " + brdg.Aggregate(0, (sum, x) => sum + x).Result);
+            Console.WriteLine();
+
+            for (var i = 0; i < n; i++)
+            {
+                sw.Restart();
+                {
+                    await slow.ForEachAsync(next);
+                }
+                Console.WriteLine("SLOW " + sw.Elapsed);
+
+                sw.Restart();
+                {
+                    await fast.ForEachAsync(next);
+                }
+                Console.WriteLine("FAST " + sw.Elapsed);
+
+                sw.Restart();
+                {
+                    await brdg.ForEachAsync(next);
+                }
+                Console.WriteLine("BRDG " + sw.Elapsed);
+
+                Console.WriteLine();
+            }
+
+            Console.WriteLine();
+        }
+
+        static async Task Async2(int n)
+        {
+            Console.WriteLine("IAsyncEnumerable<T> and IAsyncFastEnumerable<T> - Asynchronous query operators");
+            Console.WriteLine();
+
+            var sw = new Stopwatch();
+
+            var N = 10_000_000;
+
+            var next = new Func<int, Task>(_ => Task.CompletedTask);
+
+            var slowRange = AsyncEnumerable.Range(0, N);
+            var fastRange = AsyncFastEnumerable.Range(0, N);
+            var brdgRange = slowRange.ToAsyncFastEnumerable();
+
+            var slow = slowRange.Where(x => Task.FromResult(x % 2 == 0)).Select(x => Task.FromResult(x + 1));
+            var fast = fastRange.Where(x => Task.FromResult(x % 2 == 0)).Select(x => Task.FromResult(x + 1));
+            var brdg = brdgRange.Where(x => Task.FromResult(x % 2 == 0)).Select(x => Task.FromResult(x + 1)).ToAsyncEnumerable();
+
+            Console.WriteLine("slow.Sum() = " + slow.Aggregate(0, (sum, x) => sum + x).Result);
+            Console.WriteLine("fast.Sum() = " + fast.Aggregate(0, (sum, x) => sum + x).Result);
+            Console.WriteLine("brdg.Sum() = " + brdg.Aggregate(0, (sum, x) => sum + x).Result);
+            Console.WriteLine();
+
+            for (var i = 0; i < n; i++)
+            {
+                sw.Restart();
+                {
+                    await slow.ForEachAsync(next);
+                }
+                Console.WriteLine("SLOW " + sw.Elapsed);
+
+                sw.Restart();
+                {
+                    await fast.ForEachAsync(next);
+                }
+                Console.WriteLine("FAST " + sw.Elapsed);
+
+                sw.Restart();
+                {
+                    await brdg.ForEachAsync(next);
+                }
+                Console.WriteLine("BRDG " + sw.Elapsed);
+
+                Console.WriteLine();
+            }
+
+            Console.WriteLine();
+        }
+    }
+}
+
+namespace System
+{
+    public interface IAsyncDisposable
+    {
+        Task DisposeAsync();
+    }
+}
+
+namespace System.Collections.Generic
+{
+    public interface IAsyncEnumerable<out T>
+    {
+        IAsyncEnumerator<T> GetAsyncEnumerator();
+    }
+
+    public interface IAsyncEnumerator<out T> : IAsyncDisposable
+    {
+        Task<bool> MoveNextAsync();
+        T Current { get; }
+    }
+
+    public interface IFastEnumerable<out T>
+    {
+        IFastEnumerator<T> GetEnumerator();
+    }
+
+    public interface IFastEnumerator<out T> : IDisposable
+    {
+        T TryGetNext(out bool success);
+    }
+
+    public interface IAsyncFastEnumerable<out T>
+    {
+        IAsyncFastEnumerator<T> GetAsyncEnumerator();
+    }
+
+    public interface IAsyncFastEnumerator<out T> : IAsyncDisposable
+    {
+        Task<bool> WaitForNextAsync();
+        T TryGetNext(out bool success);
+    }
+}
+
+namespace System.Labs.Linq
+{
+    internal abstract class Iterator<T> : IEnumerable<T>, IEnumerator<T>
+    {
+        private readonly int _threadId;
+        internal int _state;
+        protected T _current;
+
+        protected Iterator()
+        {
+            _threadId = Environment.CurrentManagedThreadId;
+        }
+
+        public abstract Iterator<T> Clone();
+
+        public virtual void Dispose()
+        {
+            _state = -1;
+        }
+
+        public IEnumerator<T> GetEnumerator()
+        {
+            Iterator<T> enumerator = _state == 0 && _threadId == Environment.CurrentManagedThreadId ? this : Clone();
+            enumerator._state = 1;
+            return enumerator;
+        }
+
+        public abstract bool MoveNext();
+
+        public T Current => _current;
+
+        object IEnumerator.Current => _current;
+
+        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+
+        public void Reset() => throw new NotSupportedException();
+    }
+
+    internal abstract class AsyncIterator<T> : IAsyncEnumerable<T>, IAsyncEnumerator<T>
+    {
+        private readonly int _threadId;
+        internal int _state;
+        protected T _current;
+
+        protected AsyncIterator()
+        {
+            _threadId = Environment.CurrentManagedThreadId;
+        }
+
+        public abstract AsyncIterator<T> Clone();
+
+        public virtual Task DisposeAsync()
+        {
+            _state = -1;
+            return Task.CompletedTask;
+        }
+
+        public IAsyncEnumerator<T> GetAsyncEnumerator()
+        {
+            AsyncIterator<T> enumerator = _state == 0 && _threadId == Environment.CurrentManagedThreadId ? this : Clone();
+            enumerator._state = 1;
+            return enumerator;
+        }
+
+        public abstract Task<bool> MoveNextAsync();
+
+        public T Current => _current;
+    }
+
+    internal abstract class FastIterator<T> : IFastEnumerable<T>, IFastEnumerator<T>
+    {
+        private readonly int _threadId;
+        internal int _state;
+
+        protected FastIterator()
+        {
+            _threadId = Environment.CurrentManagedThreadId;
+        }
+
+        public abstract FastIterator<T> Clone();
+
+        public virtual void Dispose()
+        {
+            _state = -1;
+        }
+
+        public IFastEnumerator<T> GetEnumerator()
+        {
+            FastIterator<T> enumerator = _state == 0 && _threadId == Environment.CurrentManagedThreadId ? this : Clone();
+            enumerator._state = 1;
+            return enumerator;
+        }
+
+        public abstract T TryGetNext(out bool success);
+    }
+
+    internal abstract class AsyncFastIterator<T> : IAsyncFastEnumerable<T>, IAsyncFastEnumerator<T>
+    {
+        private readonly int _threadId;
+        internal int _state;
+
+        protected AsyncFastIterator()
+        {
+            _threadId = Environment.CurrentManagedThreadId;
+        }
+
+        public abstract AsyncFastIterator<T> Clone();
+
+        public virtual Task DisposeAsync()
+        {
+            _state = -1;
+            return Task.CompletedTask;
+        }
+
+        public IAsyncFastEnumerator<T> GetAsyncEnumerator()
+        {
+            AsyncFastIterator<T> enumerator = _state == 0 && _threadId == Environment.CurrentManagedThreadId ? this : Clone();
+            enumerator._state = 1;
+            return enumerator;
+        }
+
+        public abstract Task<bool> WaitForNextAsync();
+
+        public abstract T TryGetNext(out bool success);
+    }
+
+    public static class Enumerable
+    {
+        public static R Aggregate<T, R>(this IEnumerable<T> source, R seed, Func<R, T, R> aggregate)
+        {
+            var res = seed;
+
+            foreach (var item in source)
+            {
+                res = aggregate(res, item);
+            }
+
+            return res;
+        }
+
+        public static IEnumerable<T> Empty<T>() => EmptyIterator<T>.Instance;
+
+        public static void ForEach<T>(this IEnumerable<T> source, Action<T> next)
+        {
+            foreach (var item in source)
+            {
+                next(item);
+            }
+        }
+
+        public static IEnumerable<int> Range(int start, int count) => new RangeIterator(start, count);
+
+        public static IEnumerable<R> Select<T, R>(this IEnumerable<T> source, Func<T, R> selector) => new SelectIterator<T, R>(source, selector);
+
+        public static IEnumerable<T> Where<T>(this IEnumerable<T> source, Func<T, bool> predicate) => new WhereIterator<T>(source, predicate);
+
+        private sealed class EmptyIterator<T> : IEnumerable<T>, IEnumerator<T>
+        {
+            public static readonly EmptyIterator<T> Instance = new EmptyIterator<T>();
+
+            public T Current => default(T);
+
+            object IEnumerator.Current => default(T);
+
+            public void Dispose() { }
+
+            public IEnumerator<T> GetEnumerator() => this;
+
+            public bool MoveNext() => false;
+
+            public void Reset() { }
+
+            IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+        }
+
+        private sealed class RangeIterator : Iterator<int>
+        {
+            private readonly int _start;
+            private readonly int _end;
+            private int _next;
+
+            public RangeIterator(int start, int count)
+            {
+                _start = start;
+                _end = start + count;
+            }
+
+            public override Iterator<int> Clone() => new RangeIterator(_start, _end - _start);
+
+            public override bool MoveNext()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _next = _start;
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        if (_next < _end)
+                        {
+                            _current = _next++;
+                            return true;
+                        }
+                        break;
+                }
+
+                return false;
+            }
+        }
+
+        private sealed class SelectIterator<T, R> : Iterator<R>
+        {
+            private readonly IEnumerable<T> _source;
+            private readonly Func<T, R> _selector;
+            private IEnumerator<T> _enumerator;
+
+            public SelectIterator(IEnumerable<T> source, Func<T, R> selector)
+            {
+                _source = source;
+                _selector = selector;
+            }
+
+            public override Iterator<R> Clone() => new SelectIterator<T, R>(_source, _selector);
+
+            public override bool MoveNext()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        if (_enumerator.MoveNext())
+                        {
+                            _current = _selector(_enumerator.Current);
+                            return true;
+                        }
+                        break;
+                }
+
+                return false;
+            }
+
+            public override void Dispose() => _enumerator?.Dispose();
+        }
+
+        private sealed class WhereIterator<T> : Iterator<T>
+        {
+            private readonly IEnumerable<T> _source;
+            private readonly Func<T, bool> _predicate;
+            private IEnumerator<T> _enumerator;
+
+            public WhereIterator(IEnumerable<T> source, Func<T, bool> predicate)
+            {
+                _source = source;
+                _predicate = predicate;
+            }
+
+            public override Iterator<T> Clone() => new WhereIterator<T>(_source, _predicate);
+
+            public override bool MoveNext()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        while (_enumerator.MoveNext())
+                        {
+                            var item = _enumerator.Current;
+
+                            if (_predicate(item))
+                            {
+                                _current = item;
+                                return true;
+                            }
+                        }
+                        break;
+                }
+
+                return false;
+            }
+
+            public override void Dispose() => _enumerator?.Dispose();
+        }
+    }
+
+    public static class FastEnumerable
+    {
+        public static R Aggregate<T, R>(this IFastEnumerable<T> source, R seed, Func<R, T, R> aggregate)
+        {
+            var res = seed;
+
+            using (var e = source.GetEnumerator())
+            {
+                while (true)
+                {
+                    var item = e.TryGetNext(out var success);
+
+                    if (!success)
+                    {
+                        break;
+                    }
+
+                    res = aggregate(res, item);
+                }
+            }
+
+            return res;
+        }
+
+        public static IFastEnumerable<T> Empty<T>() => EmptyIterator<T>.Instance;
+
+        public static void ForEach<T>(this IFastEnumerable<T> source, Action<T> next)
+        {
+            using (var e = source.GetEnumerator())
+            {
+                while (true)
+                {
+                    var item = e.TryGetNext(out var success);
+
+                    if (!success)
+                    {
+                        break;
+                    }
+
+                    next(item);
+                }
+            }
+        }
+
+        public static IFastEnumerable<int> Range(int start, int count) => new RangeIterator(start, count);
+
+        public static IFastEnumerable<R> Select<T, R>(this IFastEnumerable<T> source, Func<T, R> selector) => new SelectFastIterator<T, R>(source, selector);
+
+        public static IFastEnumerable<T> ToFastEnumerable<T>(this IEnumerable<T> source) => new EnumerableToFastEnumerable<T>(source);
+
+        public static IEnumerable<T> ToEnumerable<T>(this IFastEnumerable<T> source) => new FastEnumerableToEnumerable<T>(source);
+
+        public static IFastEnumerable<T> Where<T>(this IFastEnumerable<T> source, Func<T, bool> predicate) => new WhereFastIterator<T>(source, predicate);
+
+        private sealed class EmptyIterator<T> : IFastEnumerable<T>, IFastEnumerator<T>
+        {
+            public static readonly EmptyIterator<T> Instance = new EmptyIterator<T>();
+
+            public void Dispose() { }
+
+            public IFastEnumerator<T> GetEnumerator() => this;
+
+            public T TryGetNext(out bool success)
+            {
+                success = false;
+                return default(T);
+            }
+        }
+
+        private sealed class EnumerableToFastEnumerable<T> : FastIterator<T>
+        {
+            private readonly IEnumerable<T> _source;
+            private IEnumerator<T> _enumerator;
+
+            public EnumerableToFastEnumerable(IEnumerable<T> source)
+            {
+                _source = source;
+            }
+
+            public override FastIterator<T> Clone() => new EnumerableToFastEnumerable<T>(_source);
+
+            public override T TryGetNext(out bool success)
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        success = _enumerator.MoveNext();
+                        if (success)
+                        {
+                            return _enumerator.Current;
+                        }
+                        break;
+                }
+
+                success = false;
+                return default(T);
+            }
+
+            public override void Dispose() => _enumerator?.Dispose();
+        }
+
+        private sealed class FastEnumerableToEnumerable<T> : Iterator<T>
+        {
+            private readonly IFastEnumerable<T> _source;
+            private IFastEnumerator<T> _enumerator;
+
+            public FastEnumerableToEnumerable(IFastEnumerable<T> source)
+            {
+                _source = source;
+            }
+
+            public override Iterator<T> Clone() => new FastEnumerableToEnumerable<T>(_source);
+
+            public override bool MoveNext()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        _current = _enumerator.TryGetNext(out var success);
+                        return success;
+                }
+
+                return false;
+            }
+
+            public override void Dispose() => _enumerator?.Dispose();
+        }
+
+        private sealed class RangeIterator : FastIterator<int>
+        {
+            private readonly int _start;
+            private readonly int _end;
+            private int _next;
+
+            public RangeIterator(int start, int count)
+            {
+                _start = start;
+                _end = start + count;
+            }
+
+            public override FastIterator<int> Clone() => new RangeIterator(_start, _end - _start);
+
+            public override int TryGetNext(out bool success)
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _next = _start;
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        if (_next < _end)
+                        {
+                            success = true;
+                            return _next++;
+                        }
+                        break;
+                }
+
+                success = false;
+                return default(int);
+            }
+        }
+
+        private sealed class SelectFastIterator<T, R> : FastIterator<R>
+        {
+            private readonly IFastEnumerable<T> _source;
+            private readonly Func<T, R> _selector;
+            private IFastEnumerator<T> _enumerator;
+
+            public SelectFastIterator(IFastEnumerable<T> source, Func<T, R> selector)
+            {
+                _source = source;
+                _selector = selector;
+            }
+
+            public override FastIterator<R> Clone() => new SelectFastIterator<T, R>(_source, _selector);
+
+            public override R TryGetNext(out bool success)
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        var item = _enumerator.TryGetNext(out success);
+                        if (success)
+                        {
+                            return _selector(item);
+                        }
+                        break;
+                }
+
+                success = false;
+                return default(R);
+            }
+
+            public override void Dispose() => _enumerator?.Dispose();
+        }
+
+        private sealed class WhereFastIterator<T> : FastIterator<T>
+        {
+            private readonly IFastEnumerable<T> _source;
+            private readonly Func<T, bool> _predicate;
+            private IFastEnumerator<T> _enumerator;
+
+            public WhereFastIterator(IFastEnumerable<T> source, Func<T, bool> predicate)
+            {
+                _source = source;
+                _predicate = predicate;
+            }
+
+            public override FastIterator<T> Clone() => new WhereFastIterator<T>(_source, _predicate);
+
+            public override T TryGetNext(out bool success)
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        while (true)
+                        {
+                            var item = _enumerator.TryGetNext(out success);
+                            if (!success)
+                            {
+                                break;
+                            }
+
+                            if (_predicate(item))
+                            {
+                                return item;
+                            }
+                        }
+                        break;
+                }
+
+                success = false;
+                return default(T);
+            }
+
+            public override void Dispose() => _enumerator?.Dispose();
+        }
+    }
+
+    public static class AsyncEnumerable
+    {
+        private static readonly Task<bool> True = Task.FromResult(true);
+        private static readonly Task<bool> False = Task.FromResult(false);
+
+        public static async Task<R> Aggregate<T, R>(this IAsyncEnumerable<T> source, R seed, Func<R, T, R> aggregate)
+        {
+            var res = seed;
+
+            var e = source.GetAsyncEnumerator();
+
+            try
+            {
+                while (await e.MoveNextAsync().ConfigureAwait(false))
+                {
+                    res = aggregate(res, e.Current);
+                }
+            }
+            finally
+            {
+                await e.DisposeAsync().ConfigureAwait(false);
+            }
+
+            return res;
+        }
+
+        public static async Task<R> Aggregate<T, R>(this IAsyncEnumerable<T> source, R seed, Func<R, T, Task<R>> aggregate)
+        {
+            var res = seed;
+
+            var e = source.GetAsyncEnumerator();
+
+            try
+            {
+                while (true)
+                {
+                    while (await e.MoveNextAsync().ConfigureAwait(false))
+                    {
+                        res = await aggregate(res, e.Current).ConfigureAwait(false);
+                    }
+                }
+            }
+            finally
+            {
+                await e.DisposeAsync().ConfigureAwait(false);
+            }
+
+            return res;
+        }
+
+        public static IAsyncEnumerable<T> Empty<T>() => EmptyIterator<T>.Instance;
+
+        public static async Task ForEachAsync<T>(this IAsyncEnumerable<T> source, Func<T, Task> next)
+        {
+            var e = source.GetAsyncEnumerator();
+
+            try
+            {
+                while (await e.MoveNextAsync().ConfigureAwait(false))
+                {
+                    var item = e.Current;
+                    await next(item).ConfigureAwait(false);
+                }
+            }
+            finally
+            {
+                await e.DisposeAsync().ConfigureAwait(false);
+            }
+        }
+
+        public static IAsyncEnumerable<int> Range(int start, int count) => new RangeIterator(start, count);
+
+        public static IAsyncEnumerable<R> Select<T, R>(this IAsyncEnumerable<T> source, Func<T, R> selector) => new SelectIterator<T, R>(source, selector);
+
+        public static IAsyncEnumerable<R> Select<T, R>(this IAsyncEnumerable<T> source, Func<T, Task<R>> selector) => new SelectIteratorWithTask<T, R>(source, selector);
+
+        public static IAsyncEnumerable<T> Where<T>(this IAsyncEnumerable<T> source, Func<T, bool> predicate) => new WhereIterator<T>(source, predicate);
+
+        public static IAsyncEnumerable<T> Where<T>(this IAsyncEnumerable<T> source, Func<T, Task<bool>> predicate) => new WhereIteratorWithTask<T>(source, predicate);
+
+        private sealed class EmptyIterator<T> : IAsyncEnumerable<T>, IAsyncEnumerator<T>
+        {
+            public static readonly EmptyIterator<T> Instance = new EmptyIterator<T>();
+
+            public T Current => default(T);
+
+            public Task DisposeAsync() => Task.CompletedTask;
+
+            public IAsyncEnumerator<T> GetAsyncEnumerator() => this;
+
+            public Task<bool> MoveNextAsync() => False;
+        }
+
+        private sealed class RangeIterator : AsyncIterator<int>
+        {
+            private readonly int _start;
+            private readonly int _end;
+            private int _next;
+
+            public RangeIterator(int start, int count)
+            {
+                _start = start;
+                _end = start + count;
+            }
+
+            public override AsyncIterator<int> Clone() => new RangeIterator(_start, _end - _start);
+
+            public override Task<bool> MoveNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _next = _start;
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        if (_next < _end)
+                        {
+                            _current = _next++;
+                            return True;
+                        }
+                        break;
+                }
+
+                return False;
+            }
+        }
+
+        private sealed class SelectIterator<T, R> : AsyncIterator<R>
+        {
+            private readonly IAsyncEnumerable<T> _source;
+            private readonly Func<T, R> _selector;
+            private IAsyncEnumerator<T> _enumerator;
+
+            public SelectIterator(IAsyncEnumerable<T> source, Func<T, R> selector)
+            {
+                _source = source;
+                _selector = selector;
+            }
+
+            public override AsyncIterator<R> Clone() => new SelectIterator<T, R>(_source, _selector);
+
+            public override async Task<bool> MoveNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        if (await _enumerator.MoveNextAsync().ConfigureAwait(false))
+                        {
+                            _current = _selector(_enumerator.Current);
+                            return true;
+                        }
+                        break;
+                }
+
+                return false;
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+        }
+
+        private sealed class SelectIteratorWithTask<T, R> : AsyncIterator<R>
+        {
+            private readonly IAsyncEnumerable<T> _source;
+            private readonly Func<T, Task<R>> _selector;
+            private IAsyncEnumerator<T> _enumerator;
+
+            public SelectIteratorWithTask(IAsyncEnumerable<T> source, Func<T, Task<R>> selector)
+            {
+                _source = source;
+                _selector = selector;
+            }
+
+            public override AsyncIterator<R> Clone() => new SelectIteratorWithTask<T, R>(_source, _selector);
+
+            public override async Task<bool> MoveNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        if (await _enumerator.MoveNextAsync().ConfigureAwait(false))
+                        {
+                            _current = await _selector(_enumerator.Current).ConfigureAwait(false);
+                            return true;
+                        }
+                        break;
+                }
+
+                return false;
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+        }
+
+        private sealed class WhereIterator<T> : AsyncIterator<T>
+        {
+            private readonly IAsyncEnumerable<T> _source;
+            private readonly Func<T, bool> _predicate;
+            private IAsyncEnumerator<T> _enumerator;
+
+            public WhereIterator(IAsyncEnumerable<T> source, Func<T, bool> predicate)
+            {
+                _source = source;
+                _predicate = predicate;
+            }
+
+            public override AsyncIterator<T> Clone() => new WhereIterator<T>(_source, _predicate);
+
+            public override async Task<bool> MoveNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        while (await _enumerator.MoveNextAsync().ConfigureAwait(false))
+                        {
+                            var item = _enumerator.Current;
+
+                            if (_predicate(item))
+                            {
+                                _current = item;
+                                return true;
+                            }
+                        }
+                        break;
+                }
+
+                return false;
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+        }
+
+        private sealed class WhereIteratorWithTask<T> : AsyncIterator<T>
+        {
+            private readonly IAsyncEnumerable<T> _source;
+            private readonly Func<T, Task<bool>> _predicate;
+            private IAsyncEnumerator<T> _enumerator;
+
+            public WhereIteratorWithTask(IAsyncEnumerable<T> source, Func<T, Task<bool>> predicate)
+            {
+                _source = source;
+                _predicate = predicate;
+            }
+
+            public override AsyncIterator<T> Clone() => new WhereIteratorWithTask<T>(_source, _predicate);
+
+            public override async Task<bool> MoveNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        while (await _enumerator.MoveNextAsync().ConfigureAwait(false))
+                        {
+                            var item = _enumerator.Current;
+
+                            if (await _predicate(item).ConfigureAwait(false))
+                            {
+                                _current = item;
+                                return true;
+                            }
+                        }
+                        break;
+                }
+
+                return false;
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+        }
+    }
+
+    public static class AsyncFastEnumerable
+    {
+        private static readonly Task<bool> True = Task.FromResult(true);
+        private static readonly Task<bool> False = Task.FromResult(false);
+
+        public static async Task<R> Aggregate<T, R>(this IAsyncFastEnumerable<T> source, R seed, Func<R, T, R> aggregate)
+        {
+            var res = seed;
+
+            var e = source.GetAsyncEnumerator();
+
+            try
+            {
+                while (await e.WaitForNextAsync().ConfigureAwait(false))
+                {
+                    while (true)
+                    {
+                        var item = e.TryGetNext(out var success);
+
+                        if (!success)
+                        {
+                            break;
+                        }
+
+                        res = aggregate(res, item);
+                    }
+                }
+            }
+            finally
+            {
+                await e.DisposeAsync().ConfigureAwait(false);
+            }
+
+            return res;
+        }
+
+        public static async Task<R> Aggregate<T, R>(this IAsyncFastEnumerable<T> source, R seed, Func<R, T, Task<R>> aggregate)
+        {
+            var res = seed;
+
+            var e = source.GetAsyncEnumerator();
+
+            try
+            {
+                while (await e.WaitForNextAsync().ConfigureAwait(false))
+                {
+                    while (true)
+                    {
+                        var item = e.TryGetNext(out var success);
+
+                        if (!success)
+                        {
+                            break;
+                        }
+
+                        res = await aggregate(res, item).ConfigureAwait(false);
+                    }
+                }
+            }
+            finally
+            {
+                await e.DisposeAsync().ConfigureAwait(false);
+            }
+
+            return res;
+        }
+
+        public static IAsyncFastEnumerable<T> Empty<T>() => EmptyIterator<T>.Instance;
+
+        public static async Task ForEachAsync<T>(this IAsyncFastEnumerable<T> source, Func<T, Task> next)
+        {
+            var e = source.GetAsyncEnumerator();
+
+            try
+            {
+                while (await e.WaitForNextAsync().ConfigureAwait(false))
+                {
+                    while (true)
+                    {
+                        var item = e.TryGetNext(out var success);
+
+                        if (!success)
+                        {
+                            break;
+                        }
+
+                        await next(item).ConfigureAwait(false);
+                    }
+                }
+            }
+            finally
+            {
+                await e.DisposeAsync().ConfigureAwait(false);
+            }
+        }
+
+        public static IAsyncFastEnumerable<int> Range(int start, int count) => new RangeIterator(start, count);
+
+        public static IAsyncFastEnumerable<R> Select<T, R>(this IAsyncFastEnumerable<T> source, Func<T, R> selector) => new SelectFastIterator<T, R>(source, selector);
+
+        public static IAsyncFastEnumerable<R> Select<T, R>(this IAsyncFastEnumerable<T> source, Func<T, Task<R>> selector) => new SelectFastIteratorWithTask<T, R>(source, selector);
+
+        public static IAsyncFastEnumerable<T> ToAsyncFastEnumerable<T>(this IAsyncEnumerable<T> source) => new AsyncEnumerableToAsyncFastEnumerable<T>(source);
+
+        public static IAsyncEnumerable<T> ToAsyncEnumerable<T>(this IAsyncFastEnumerable<T> source) => new AsyncFastEnumerableToAsyncEnumerable<T>(source);
+
+        public static IAsyncFastEnumerable<T> Where<T>(this IAsyncFastEnumerable<T> source, Func<T, bool> predicate) => new WhereFastIterator<T>(source, predicate);
+
+        public static IAsyncFastEnumerable<T> Where<T>(this IAsyncFastEnumerable<T> source, Func<T, Task<bool>> predicate) => new WhereFastIteratorWithTask<T>(source, predicate);
+
+        private sealed class EmptyIterator<T> : IAsyncFastEnumerable<T>, IAsyncFastEnumerator<T>
+        {
+            public static readonly EmptyIterator<T> Instance = new EmptyIterator<T>();
+
+            public Task DisposeAsync() => Task.CompletedTask;
+
+            public IAsyncFastEnumerator<T> GetAsyncEnumerator() => this;
+
+            public T TryGetNext(out bool success)
+            {
+                success = false;
+                return default(T);
+            }
+
+            public Task<bool> WaitForNextAsync() => False;
+        }
+
+        private sealed class AsyncEnumerableToAsyncFastEnumerable<T> : AsyncFastIterator<T>
+        {
+            private readonly IAsyncEnumerable<T> _source;
+            private IAsyncEnumerator<T> _enumerator;
+            private bool _hasNext;
+
+            public AsyncEnumerableToAsyncFastEnumerable(IAsyncEnumerable<T> source)
+            {
+                _source = source;
+            }
+
+            public override AsyncFastIterator<T> Clone() => new AsyncEnumerableToAsyncFastEnumerable<T>(_source);
+
+            public override T TryGetNext(out bool success)
+            {
+                success = _hasNext;
+                _hasNext = false;
+
+                return success ? _enumerator.Current : default(T);
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+
+            public override async Task<bool> WaitForNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        _hasNext = await _enumerator.MoveNextAsync().ConfigureAwait(false);
+                        return _hasNext;
+                }
+
+                return false;
+            }
+        }
+
+        private sealed class AsyncFastEnumerableToAsyncEnumerable<T> : AsyncIterator<T>
+        {
+            private readonly IAsyncFastEnumerable<T> _source;
+            private IAsyncFastEnumerator<T> _enumerator;
+
+            public AsyncFastEnumerableToAsyncEnumerable(IAsyncFastEnumerable<T> source)
+            {
+                _source = source;
+            }
+
+            public override AsyncIterator<T> Clone() => new AsyncFastEnumerableToAsyncEnumerable<T>(_source);
+
+            public override async Task<bool> MoveNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        do
+                        {
+                            while (true)
+                            {
+                                var item = _enumerator.TryGetNext(out var success);
+
+                                if (!success)
+                                {
+                                    break;
+                                }
+                                else
+                                {
+                                    _current = item;
+                                    return true;
+                                }
+                            }
+                        } while (await _enumerator.WaitForNextAsync().ConfigureAwait(false));
+
+                        break;
+                }
+
+                return false;
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+        }
+
+        private sealed class RangeIterator : AsyncFastIterator<int>
+        {
+            private readonly int _start;
+            private readonly int _end;
+            private int _next;
+
+            public RangeIterator(int start, int count)
+            {
+                _start = start;
+                _end = start + count;
+            }
+
+            public override AsyncFastIterator<int> Clone() => new RangeIterator(_start, _end - _start);
+
+            public override int TryGetNext(out bool success)
+            {
+                if (_state == 2 && _next < _end)
+                {
+                    success = true;
+                    return _next++;
+                }
+
+                success = false;
+                return default(int);
+            }
+
+            public override Task<bool> WaitForNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _next = _start;
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        if (_next < _end)
+                        {
+                            return True;
+                        }
+                        break;
+                }
+
+                return False;
+            }
+        }
+
+        private sealed class SelectFastIterator<T, R> : AsyncFastIterator<R>
+        {
+            private readonly IAsyncFastEnumerable<T> _source;
+            private readonly Func<T, R> _selector;
+            private IAsyncFastEnumerator<T> _enumerator;
+
+            public SelectFastIterator(IAsyncFastEnumerable<T> source, Func<T, R> selector)
+            {
+                _source = source;
+                _selector = selector;
+            }
+
+            public override AsyncFastIterator<R> Clone() => new SelectFastIterator<T, R>(_source, _selector);
+
+            public override R TryGetNext(out bool success)
+            {
+                if (_enumerator != null)
+                {
+                    var item = _enumerator.TryGetNext(out success);
+                    if (success)
+                    {
+                        return _selector(item);
+                    }
+                }
+
+                success = false;
+                return default(R);
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+
+            public override Task<bool> WaitForNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        return _enumerator.WaitForNextAsync();
+                }
+
+                return False;
+            }
+        }
+
+        private sealed class SelectFastIteratorWithTask<T, R> : AsyncFastIterator<R>
+        {
+            private readonly IAsyncFastEnumerable<T> _source;
+            private readonly Func<T, Task<R>> _selector;
+            private IAsyncFastEnumerator<T> _enumerator;
+            private bool _hasNext;
+            private R _next;
+
+            public SelectFastIteratorWithTask(IAsyncFastEnumerable<T> source, Func<T, Task<R>> selector)
+            {
+                _source = source;
+                _selector = selector;
+            }
+
+            public override AsyncFastIterator<R> Clone() => new SelectFastIteratorWithTask<T, R>(_source, _selector);
+
+            public override R TryGetNext(out bool success)
+            {
+                success = _hasNext;
+                _hasNext = false;
+
+                return success ? _next : default(R);
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+
+            public override async Task<bool> WaitForNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        do
+                        {
+                            while (true)
+                            {
+                                var item = _enumerator.TryGetNext(out var success);
+
+                                if (!success)
+                                {
+                                    break;
+                                }
+                                else
+                                {
+                                    _hasNext = true;
+                                    _next = await _selector(item).ConfigureAwait(false);
+                                    return true;
+                                }
+                            }
+                        }
+                        while (await _enumerator.WaitForNextAsync().ConfigureAwait(false));
+
+                        break;
+                }
+
+                _hasNext = false;
+                _next = default(R);
+
+                return false;
+            }
+        }
+
+        private sealed class WhereFastIterator<T> : AsyncFastIterator<T>
+        {
+            private readonly IAsyncFastEnumerable<T> _source;
+            private readonly Func<T, bool> _predicate;
+            private IAsyncFastEnumerator<T> _enumerator;
+
+            public WhereFastIterator(IAsyncFastEnumerable<T> source, Func<T, bool> predicate)
+            {
+                _source = source;
+                _predicate = predicate;
+            }
+
+            public override AsyncFastIterator<T> Clone() => new WhereFastIterator<T>(_source, _predicate);
+
+            public override T TryGetNext(out bool success)
+            {
+                if (_enumerator != null)
+                {
+                    while (true)
+                    {
+                        var item = _enumerator.TryGetNext(out success);
+                        if (!success)
+                        {
+                            break;
+                        }
+
+                        if (_predicate(item))
+                        {
+                            return item;
+                        }
+                    }
+                }
+
+                success = false;
+                return default(T);
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+
+            public override Task<bool> WaitForNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        return _enumerator.WaitForNextAsync();
+                }
+
+                return False;
+            }
+        }
+
+        private sealed class WhereFastIteratorWithTask<T> : AsyncFastIterator<T>
+        {
+            private readonly IAsyncFastEnumerable<T> _source;
+            private readonly Func<T, Task<bool>> _predicate;
+            private IAsyncFastEnumerator<T> _enumerator;
+            private bool _hasNext;
+            private T _next;
+
+            public WhereFastIteratorWithTask(IAsyncFastEnumerable<T> source, Func<T, Task<bool>> predicate)
+            {
+                _source = source;
+                _predicate = predicate;
+            }
+
+            public override AsyncFastIterator<T> Clone() => new WhereFastIteratorWithTask<T>(_source, _predicate);
+
+            public override T TryGetNext(out bool success)
+            {
+                success = _hasNext;
+                _hasNext = false;
+
+                return success ? _next : default(T);
+            }
+
+            public override Task DisposeAsync() => _enumerator?.DisposeAsync() ?? Task.CompletedTask;
+
+            public override async Task<bool> WaitForNextAsync()
+            {
+                switch (_state)
+                {
+                    case 1:
+                        _enumerator = _source.GetAsyncEnumerator();
+                        _state = 2;
+                        goto case 2;
+
+                    case 2:
+                        do
+                        {
+                            while (true)
+                            {
+                                var item = _enumerator.TryGetNext(out var success);
+
+                                if (!success)
+                                {
+                                    break;
+                                }
+                                else
+                                {
+                                    if (await _predicate(item).ConfigureAwait(false))
+                                    {
+                                        _hasNext = true;
+                                        _next = item;
+                                        return true;
+                                    }
+                                }
+                            }
+                        }
+                        while (await _enumerator.WaitForNextAsync().ConfigureAwait(false));
+
+                        break;
+                }
+
+                _hasNext = false;
+                _next = default(T);
+
+                return false;
+            }
+        }
+    }
+}

+ 94 - 0
Ix.NET/Source/Ix.Async.NET.sln

@@ -0,0 +1,94 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28606.126
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B733D97A-F1ED-4FC3-BF8E-9AC47A89DE96}"
+	ProjectSection(SolutionItems) = preProject
+		..\..\.editorconfig = ..\..\.editorconfig
+		AsyncQueryableGenerator.t4 = AsyncQueryableGenerator.t4
+		..\..\azure-pipelines.ix.yml = ..\..\azure-pipelines.ix.yml
+		CodeCoverage.runsettings = CodeCoverage.runsettings
+		Directory.build.props = Directory.build.props
+		Directory.build.targets = Directory.build.targets
+		global.json = global.json
+		NuGet.Config = NuGet.Config
+		version.json = version.json
+	EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Async", "System.Interactive.Async\System.Interactive.Async.csproj", "{A9F6D09B-15B9-4CE8-867F-6F3383C5F247}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Async.Providers", "System.Interactive.Async.Providers\System.Interactive.Async.Providers.csproj", "{33691BB5-DD5B-4FED-8EE3-52CEE0DE2550}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Async.Tests", "System.Interactive.Async.Tests\System.Interactive.Async.Tests.csproj", "{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async", "System.Linq.Async\System.Linq.Async.csproj", "{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async.Queryable", "System.Linq.Async.Queryable\System.Linq.Async.Queryable.csproj", "{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{80EFE3A1-1414-42EA-949B-1B5370A1B2EA}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async.Tests", "System.Linq.Async.Tests\System.Linq.Async.Tests.csproj", "{2E23D7AD-0B21-4725-87C4-BD43271260A1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async.Queryable.Tests", "System.Linq.Async.Queryable.Tests\System.Linq.Async.Queryable.Tests.csproj", "{134E9066-6217-4AF0-B408-47D92AB595BD}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Async.Providers.Tests", "System.Interactive.Async.Providers.Tests\System.Interactive.Async.Providers.Tests.csproj", "{974056C0-91BD-4EB6-8431-E30A614FD1D4}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{A9F6D09B-15B9-4CE8-867F-6F3383C5F247}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A9F6D09B-15B9-4CE8-867F-6F3383C5F247}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A9F6D09B-15B9-4CE8-867F-6F3383C5F247}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A9F6D09B-15B9-4CE8-867F-6F3383C5F247}.Release|Any CPU.Build.0 = Release|Any CPU
+		{33691BB5-DD5B-4FED-8EE3-52CEE0DE2550}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{33691BB5-DD5B-4FED-8EE3-52CEE0DE2550}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{33691BB5-DD5B-4FED-8EE3-52CEE0DE2550}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{33691BB5-DD5B-4FED-8EE3-52CEE0DE2550}.Release|Any CPU.Build.0 = Release|Any CPU
+		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Release|Any CPU.Build.0 = Release|Any CPU
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1}.Release|Any CPU.Build.0 = Release|Any CPU
+		{134E9066-6217-4AF0-B408-47D92AB595BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{134E9066-6217-4AF0-B408-47D92AB595BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{134E9066-6217-4AF0-B408-47D92AB595BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{134E9066-6217-4AF0-B408-47D92AB595BD}.Release|Any CPU.Build.0 = Release|Any CPU
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{A9F6D09B-15B9-4CE8-867F-6F3383C5F247} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{33691BB5-DD5B-4FED-8EE3-52CEE0DE2550} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+		{134E9066-6217-4AF0-B408-47D92AB595BD} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {AF70B0C6-C9D9-43B1-9BE4-08720EC1B7B7}
+	EndGlobalSection
+EndGlobal

+ 76 - 8
Ix.NET/Source/Ix.NET.sln

@@ -1,9 +1,9 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26823.1
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28606.126
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B733D97A-F1ED-4FC3-BF8E-9AC47A89DE96}"
 	ProjectSection(SolutionItems) = preProject
@@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		Directory.build.targets = Directory.build.targets
 		global.json = global.json
 		NuGet.Config = NuGet.Config
+		version.json = version.json
 	EndProjectSection
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive", "System.Interactive\System.Interactive.csproj", "{FF97CD0F-8108-4B66-8A34-42190B459180}"
@@ -28,6 +29,26 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Tests",
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Async.Tests", "System.Interactive.Async.Tests\System.Interactive.Async.Tests.csproj", "{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async", "System.Linq.Async\System.Linq.Async.csproj", "{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async.Queryable", "System.Linq.Async.Queryable\System.Linq.Async.Queryable.csproj", "{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{80EFE3A1-1414-42EA-949B-1B5370A1B2EA}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dev", "dev", "{61683064-A120-44A7-A174-E19154F6D84F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playground", "Playground\Playground.csproj", "{CFDA4685-B2AF-46FE-81C1-55A291B9B1B0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCompare", "ApiCompare\ApiCompare.csproj", "{792093F9-83E4-4630-9652-4328FDAED15F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async.Tests", "System.Linq.Async.Tests\System.Linq.Async.Tests.csproj", "{2E23D7AD-0B21-4725-87C4-BD43271260A1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async.Queryable.Tests", "System.Linq.Async.Queryable.Tests\System.Linq.Async.Queryable.Tests.csproj", "{134E9066-6217-4AF0-B408-47D92AB595BD}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Async.Providers.Tests", "System.Interactive.Async.Providers.Tests\System.Interactive.Async.Providers.Tests.csproj", "{974056C0-91BD-4EB6-8431-E30A614FD1D4}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FasterLinq", "FasterLinq\FasterLinq.csproj", "{1C966C34-0AA1-44D8-9E7D-C7866958F2D6}"
+EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Refs", "Refs", "{A3D72E6E-4ADA-42E0-8B2A-055B1F244281}"
 	ProjectSection(SolutionItems) = preProject
 		refs\Directory.build.props = refs\Directory.build.props
@@ -39,6 +60,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Interactive.Provider
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks.System.Interactive", "Benchmarks.System.Interactive\Benchmarks.System.Interactive.csproj", "{3285529A-8227-4D40-B524-1A1F919F0E7B}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Async.Ref", "refs\System.Linq.Async.Ref\System.Linq.Async.Ref.csproj", "{1754B36C-D0DB-4E5D-8C30-1F116046DC0F}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -69,29 +92,74 @@ Global
 		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC}.Release|Any CPU.Build.0 = Release|Any CPU
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CFDA4685-B2AF-46FE-81C1-55A291B9B1B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CFDA4685-B2AF-46FE-81C1-55A291B9B1B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CFDA4685-B2AF-46FE-81C1-55A291B9B1B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CFDA4685-B2AF-46FE-81C1-55A291B9B1B0}.Release|Any CPU.Build.0 = Release|Any CPU
+		{792093F9-83E4-4630-9652-4328FDAED15F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{792093F9-83E4-4630-9652-4328FDAED15F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{792093F9-83E4-4630-9652-4328FDAED15F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{792093F9-83E4-4630-9652-4328FDAED15F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1}.Release|Any CPU.Build.0 = Release|Any CPU
+		{134E9066-6217-4AF0-B408-47D92AB595BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{134E9066-6217-4AF0-B408-47D92AB595BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{134E9066-6217-4AF0-B408-47D92AB595BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{134E9066-6217-4AF0-B408-47D92AB595BD}.Release|Any CPU.Build.0 = Release|Any CPU
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4}.Release|Any CPU.Build.0 = Release|Any CPU
+		{1C966C34-0AA1-44D8-9E7D-C7866958F2D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{1C966C34-0AA1-44D8-9E7D-C7866958F2D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{1C966C34-0AA1-44D8-9E7D-C7866958F2D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{1C966C34-0AA1-44D8-9E7D-C7866958F2D6}.Release|Any CPU.Build.0 = Release|Any CPU
 		{2EC0C302-B029-4DDB-AC91-000BF11006AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{2EC0C302-B029-4DDB-AC91-000BF11006AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{2EC0C302-B029-4DDB-AC91-000BF11006AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{2EC0C302-B029-4DDB-AC91-000BF11006AD}.Release|Any CPU.Build.0 = Release|Any CPU
 		{5DF341BE-B369-4250-AFD4-604DE8C95E45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5DF341BE-B369-4250-AFD4-604DE8C95E45}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{5DF341BE-B369-4250-AFD4-604DE8C95E45}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{5DF341BE-B369-4250-AFD4-604DE8C95E45}.Release|Any CPU.Build.0 = Release|Any CPU
 		{3285529A-8227-4D40-B524-1A1F919F0E7B}.Debug|Any CPU.ActiveCfg = Current Sources|Any CPU
 		{3285529A-8227-4D40-B524-1A1F919F0E7B}.Debug|Any CPU.Build.0 = Current Sources|Any CPU
 		{3285529A-8227-4D40-B524-1A1F919F0E7B}.Release|Any CPU.ActiveCfg = Current Sources|Any CPU
 		{3285529A-8227-4D40-B524-1A1F919F0E7B}.Release|Any CPU.Build.0 = Current Sources|Any CPU
+		{1754B36C-D0DB-4E5D-8C30-1F116046DC0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{1754B36C-D0DB-4E5D-8C30-1F116046DC0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{1754B36C-D0DB-4E5D-8C30-1F116046DC0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{1754B36C-D0DB-4E5D-8C30-1F116046DC0F}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
+		{FF97CD0F-8108-4B66-8A34-42190B459180} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{A9F6D09B-15B9-4CE8-867F-6F3383C5F247} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{CA7B7136-13EE-4F01-BC22-722875EE8569} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{33691BB5-DD5B-4FED-8EE3-52CEE0DE2550} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
 		{AFD2E6EC-C5B0-4276-A14A-467D786D0DDA} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
 		{172BD8C4-5C3E-4928-9D3F-746CF336FFEC} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+		{9B1E5420-E8F3-4B5F-A11A-4D18578F50CE} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{513F9ABD-4FB8-4AC1-89DA-C3300399F34C} = {80EFE3A1-1414-42EA-949B-1B5370A1B2EA}
+		{CFDA4685-B2AF-46FE-81C1-55A291B9B1B0} = {61683064-A120-44A7-A174-E19154F6D84F}
+		{792093F9-83E4-4630-9652-4328FDAED15F} = {61683064-A120-44A7-A174-E19154F6D84F}
+		{2E23D7AD-0B21-4725-87C4-BD43271260A1} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+		{134E9066-6217-4AF0-B408-47D92AB595BD} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+		{974056C0-91BD-4EB6-8431-E30A614FD1D4} = {87534290-A7A6-47A4-9A3A-D0D21A9AD1D4}
+		{1C966C34-0AA1-44D8-9E7D-C7866958F2D6} = {61683064-A120-44A7-A174-E19154F6D84F}
 		{2EC0C302-B029-4DDB-AC91-000BF11006AD} = {A3D72E6E-4ADA-42E0-8B2A-055B1F244281}
 		{5DF341BE-B369-4250-AFD4-604DE8C95E45} = {A3D72E6E-4ADA-42E0-8B2A-055B1F244281}
+		{1754B36C-D0DB-4E5D-8C30-1F116046DC0F} = {A3D72E6E-4ADA-42E0-8B2A-055B1F244281}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {9B5F6126-CBBA-4C3A-A3BB-26AFE56DABEC}
+		SolutionGuid = {AF70B0C6-C9D9-43B1-9BE4-08720EC1B7B7}
 	EndGlobalSection
 EndGlobal

+ 21 - 0
Ix.NET/Source/Playground/DemoAttribute.cs

@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+
+namespace Playground
+{
+    [AttributeUsage(AttributeTargets.Method)]
+    internal sealed class DemoAttribute : Attribute
+    {
+        public DemoAttribute(int index, string title)
+        {
+            Index = index;
+            Title = title;
+        }
+
+        public int Index { get; }
+        public string Title { get; }
+    }
+}

+ 17 - 0
Ix.NET/Source/Playground/Playground.csproj

@@ -0,0 +1,17 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\System.Interactive.Async.Providers\System.Interactive.Async.Providers.csproj" />
+    <ProjectReference Include="..\System.Interactive.Async\System.Interactive.Async.csproj" />
+    <ProjectReference Include="..\System.Interactive.Providers\System.Interactive.Providers.csproj" />
+    <ProjectReference Include="..\System.Interactive\System.Interactive.csproj" />
+    <ProjectReference Include="..\System.Linq.Async.Queryable\System.Linq.Async.Queryable.csproj" />
+    <ProjectReference Include="..\System.Linq.Async\System.Linq.Async.csproj" />
+  </ItemGroup>
+
+</Project>

+ 257 - 0
Ix.NET/Source/Playground/Program.cs

@@ -0,0 +1,257 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+
+namespace Playground
+{
+    class Program
+    {
+        static void Main()
+        {
+            RunDemos();
+        }
+
+        [Demo(0, "Random experimentation")]
+        static async Task Experiment()
+        {
+            // Add test code here
+            await Task.Yield(); // Suppress CS1998
+        }
+
+        [Demo(11, "LINQ to Objects for IEnumerable<T>")]
+        static void Linq()
+        {
+            var xs = new List<int> { 1, 2, 3 };
+            var ys = xs.Where(x => x % 2 == 0);
+
+            foreach (var y in ys)
+            {
+                Console.WriteLine(y);
+            }
+        }
+
+        [Demo(12, "LINQ to Objects for IQueryable<T>")]
+        static void LinqQueryable()
+        {
+            var xs = new List<int> { 1, 2, 3 }.AsQueryable();
+            var ys = xs.Where(x => x % 2 == 0);
+
+            foreach (var y in ys)
+            {
+                Console.WriteLine(y);
+            }
+        }
+
+        [Demo(21, "LINQ to Objects for IEnumerable<T> - Interactive Extensions")]
+        static void Ix()
+        {
+            var xs = new List<int> { 1, 2, 3 };
+            var ys = xs.Distinct(x => x % 2);
+
+            foreach (var y in ys)
+            {
+                Console.WriteLine(y);
+            }
+        }
+
+        [Demo(22, "LINQ to Objects for IQueryable<T> - Interactive Extensions")]
+        static void IxQueryable()
+        {
+            var xs = new List<int> { 1, 2, 3 }.AsQueryable();
+            var ys = xs.Distinct(x => x % 2);
+
+            foreach (var y in ys)
+            {
+                Console.WriteLine(y);
+            }
+        }
+
+        [Demo(31, "LINQ to Objects for IAsyncEnumerable<T>")]
+        static async Task AsyncLinq()
+        {
+            var xs = new List<int> { 1, 2, 3 };
+            var ys = xs.ToAsyncEnumerable().Where(x => x % 2 == 0);
+
+#if USE_AWAIT_FOREACH
+            await foreach (var y in ys)
+            {
+                Console.WriteLine(y);
+            }
+#else
+            var e = ys.GetAsyncEnumerator();
+
+            try
+            {
+                while (await e.MoveNextAsync())
+                {
+                    var y = e.Current;
+
+                    Console.WriteLine(y);
+                }
+            }
+            finally
+            {
+                await e.DisposeAsync();
+            }
+#endif
+        }
+
+        [Demo(32, "LINQ to Objects for IAsyncQueryable<T>")]
+        static async Task AsyncLinqQueryable()
+        {
+            var xs = new List<int> { 1, 2, 3 }.AsQueryable();
+            var ys = xs.ToAsyncEnumerable().Where(x => x % 2 == 0);
+
+#if USE_AWAIT_FOREACH
+            await foreach (var y in ys)
+            {
+                Console.WriteLine(y);
+            }
+#else
+            var e = ys.GetAsyncEnumerator();
+
+            try
+            {
+                while (await e.MoveNextAsync())
+                {
+                    var y = e.Current;
+
+                    Console.WriteLine(y);
+                }
+            }
+            finally
+            {
+                await e.DisposeAsync();
+            }
+#endif
+        }
+
+        [Demo(41, "LINQ to Objects for IAsyncEnumerable<T> - Interactive Extensions")]
+        static async Task AsyncIx()
+        {
+            var xs = new List<int> { 1, 2, 3 };
+            var ys = xs.ToAsyncEnumerable().Distinct(x => x % 2);
+
+#if USE_AWAIT_FOREACH
+            await foreach (var y in ys)
+            {
+                Console.WriteLine(y);
+            }
+#else
+            await ys.ForEachAsync(y =>
+            {
+                Console.WriteLine(y);
+            });
+#endif
+        }
+
+        [Demo(42, "LINQ to Objects for IAsyncQueryable<T> - Interactive Extensions")]
+        static async Task AsyncIxQueryable()
+        {
+            var xs = new List<int> { 1, 2, 3 }.AsQueryable();
+            var ys = xs.ToAsyncEnumerable().Distinct(x => x % 2);
+
+#if USE_AWAIT_FOREACH
+            await foreach (var y in ys)
+            {
+                Console.WriteLine(y);
+            }
+#else
+            await ys.ForEachAsync(y =>
+            {
+                Console.WriteLine(y);
+            });
+#endif
+        }
+
+        static void RunDemos()
+        {
+            var methods = (from method in typeof(Program).GetTypeInfo().GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static)
+                           let demo = method.GetCustomAttribute<DemoAttribute>()
+                           let parameters = method.GetParameters()
+                           let returnType = method.ReturnType
+                           where demo != null && parameters.Length == 0 && (returnType == typeof(void) || returnType == typeof(Task))
+                           orderby demo.Index
+                           select new { Demo = demo, Invoke = GetInvoker(method) })
+                          .ToArray();
+
+            var invokers = methods.ToDictionary(m => m.Demo.Index, m => m.Invoke);
+
+            while (true)
+            {
+                foreach (var method in methods)
+                {
+                    Console.WriteLine($"{method.Demo.Index}. {method.Demo.Title}");
+                }
+
+                Console.WriteLine();
+
+                var retry = true;
+
+                while (retry)
+                {
+                    Console.Write("Enter demo [C: Clear, X: Exit]: ");
+                    var input = Console.ReadLine().Trim().ToUpper();
+
+                    switch (input)
+                    {
+                        case "C":
+                            retry = false;
+                            Console.Clear();
+                            break;
+                        case "X":
+                            return;
+                        default:
+                            if (!int.TryParse(input, out var i) || !invokers.TryGetValue(i, out var invoke))
+                            {
+                                Console.ForegroundColor = ConsoleColor.Red;
+                                Console.WriteLine("Invalid input.");
+                                Console.ResetColor();
+                            }
+                            else
+                            {
+                                retry = false;
+
+                                Console.ForegroundColor = ConsoleColor.Cyan;
+
+                                try
+                                {
+                                    invoke();
+                                }
+                                catch (Exception ex)
+                                {
+                                    Console.ForegroundColor = ConsoleColor.Red;
+                                    Console.WriteLine(ex.Message);
+                                }
+                                finally
+                                {
+                                    Console.ResetColor();
+                                }
+                            }
+
+                            break;
+                    }
+                }
+            }
+
+            Action GetInvoker(MethodInfo method)
+            {
+                if (method.ReturnType == typeof(void))
+                {
+                    return (Action)method.CreateDelegate(typeof(Action));
+                }
+                else
+                {
+                    var invoke = (Func<Task>)method.CreateDelegate(typeof(Func<Task>));
+                    return () => invoke().GetAwaiter().GetResult();
+                }
+            }
+        }
+    }
+}

+ 3 - 8
Ix.NET/Source/System.Interactive.Async.Tests/AssertEx.cs → Ix.NET/Source/System.Interactive.Async.Providers.Tests/AssertEx.cs

@@ -1,19 +1,14 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // 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;
+
 using Xunit;
+using System;
 
 namespace Tests
 {
     internal class AssertEx
     {
-        internal static void Throws<T>(Action action)
-            where T : Exception
-        {
-            Throws<T>(action, _ => true);
-        }
-
         internal static void Throws<T>(Action action, Func<T, bool> assert)
             where T : Exception
         {
@@ -47,4 +42,4 @@ namespace Tests
             }
         }
     }
-}
+}

+ 786 - 0
Ix.NET/Source/System.Interactive.Async.Providers.Tests/AsyncQueryableExTests.Generated.cs

@@ -0,0 +1,786 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class AsyncQueryableTests
+    {
+        [Fact]
+        public void Amb1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Amb<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Amb<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
+
+            var res = AsyncQueryableEx.Amb<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Buffer1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Buffer<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.Buffer<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Buffer2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Buffer<int>(default(IAsyncQueryable<int>), 1, 1), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.Buffer<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, 1);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Catch1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Catch<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Catch<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
+
+            var res = AsyncQueryableEx.Catch<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Catch2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Catch<int, Exception>(default(IAsyncQueryable<int>), (Exception arg0) => new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Catch<int, Exception>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<Exception, IAsyncEnumerable<int>>>)), ane => ane.ParamName == "handler");
+
+            var res = AsyncQueryableEx.Catch<int, Exception>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (Exception arg0) => new int[] { default(int) }.ToAsyncEnumerable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Catch3()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Catch<int, Exception>(default(IAsyncQueryable<int>), (Exception arg0) => default(ValueTask<IAsyncEnumerable<int>>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Catch<int, Exception>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<Exception, ValueTask<IAsyncEnumerable<int>>>>)), ane => ane.ParamName == "handler");
+
+            var res = AsyncQueryableEx.Catch<int, Exception>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (Exception arg0) => default(ValueTask<IAsyncEnumerable<int>>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Catch4()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Catch<int, Exception>(default(IAsyncQueryable<int>), (Exception arg0, CancellationToken arg1) => default(ValueTask<IAsyncEnumerable<int>>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Catch<int, Exception>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<Exception, CancellationToken, ValueTask<IAsyncEnumerable<int>>>>)), ane => ane.ParamName == "handler");
+
+            var res = AsyncQueryableEx.Catch<int, Exception>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (Exception arg0, CancellationToken arg1) => default(ValueTask<IAsyncEnumerable<int>>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Concat1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Concat<int>(default(IAsyncQueryable<IAsyncEnumerable<int>>)), ane => ane.ParamName == "sources");
+
+            var res = AsyncQueryableEx.Concat<int>(new IAsyncEnumerable<int>[] { default(IAsyncEnumerable<int>) }.ToAsyncEnumerable().AsAsyncQueryable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Distinct1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Distinct2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<int>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<int>>>)), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<int>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Distinct3()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<int>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<int>>>)), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<int>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Distinct4()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Distinct5()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<int>>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<int>), EqualityComparer<int>.Default);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Distinct6()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<int>>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<int>), EqualityComparer<int>.Default);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void DistinctUntilChanged1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.DistinctUntilChanged<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void DistinctUntilChanged2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int>(default(IAsyncQueryable<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.DistinctUntilChanged<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), EqualityComparer<int>.Default);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void DistinctUntilChanged3()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void DistinctUntilChanged4()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<int>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<int>>>)), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<int>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void DistinctUntilChanged5()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<int>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<int>>>)), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<int>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void DistinctUntilChanged6()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void DistinctUntilChanged7()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<int>>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<int>), EqualityComparer<int>.Default);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void DistinctUntilChanged8()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<int>>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<int>), EqualityComparer<int>.Default);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), new NopObserver<int>()), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IObserver<int>)), ane => ane.ParamName == "observer");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new NopObserver<int>());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0) => Console.WriteLine()), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Action<int>>)), ane => ane.ParamName == "onNext");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do3()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0) => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, Task>>)), ane => ane.ParamName == "onNext");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do4()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, Task>>)), ane => ane.ParamName == "onNext");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do5()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0) => Console.WriteLine(), () => { }), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Action<int>>), () => { }), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), default(Action)), ane => ane.ParamName == "onCompleted");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), () => { });
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do6()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0) => default(Task), () => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, Task>>), () => default(Task)), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Task), default(Expression<Func<Task>>)), ane => ane.ParamName == "onCompleted");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Task), () => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do7()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(Task), (CancellationToken arg0) => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, Task>>), (CancellationToken arg0) => default(Task)), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(Task), default(Expression<Func<CancellationToken, Task>>)), ane => ane.ParamName == "onCompleted");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(Task), (CancellationToken arg0) => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do8()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine()), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Action<int>>), (Exception arg0) => Console.WriteLine()), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), default(Expression<Action<Exception>>)), ane => ane.ParamName == "onError");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do9()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0) => default(Task), (Exception arg0) => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, Task>>), (Exception arg0) => default(Task)), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Task), default(Expression<Func<Exception, Task>>)), ane => ane.ParamName == "onError");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Task), (Exception arg0) => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do10()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(Task), (Exception arg0, CancellationToken arg1) => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, Task>>), (Exception arg0, CancellationToken arg1) => default(Task)), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(Task), default(Expression<Func<Exception, CancellationToken, Task>>)), ane => ane.ParamName == "onError");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(Task), (Exception arg0, CancellationToken arg1) => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do11()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(Task), (Exception arg0, CancellationToken arg1) => default(Task), (CancellationToken arg0) => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, Task>>), (Exception arg0, CancellationToken arg1) => default(Task), (CancellationToken arg0) => default(Task)), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(Task), default(Expression<Func<Exception, CancellationToken, Task>>), (CancellationToken arg0) => default(Task)), ane => ane.ParamName == "onError");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(Task), (Exception arg0, CancellationToken arg1) => default(Task), default(Expression<Func<CancellationToken, Task>>)), ane => ane.ParamName == "onCompleted");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(Task), (Exception arg0, CancellationToken arg1) => default(Task), (CancellationToken arg0) => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do12()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine(), () => { }), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Action<int>>), (Exception arg0) => Console.WriteLine(), () => { }), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), default(Expression<Action<Exception>>), () => { }), ane => ane.ParamName == "onError");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine(), default(Action)), ane => ane.ParamName == "onCompleted");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine(), () => { });
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Do13()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(default(IAsyncQueryable<int>), (int arg0) => default(Task), (Exception arg0) => default(Task), () => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, Task>>), (Exception arg0) => default(Task), () => default(Task)), ane => ane.ParamName == "onNext");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Task), default(Expression<Func<Exception, Task>>), () => default(Task)), ane => ane.ParamName == "onError");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Task), (Exception arg0) => default(Task), default(Expression<Func<Task>>)), ane => ane.ParamName == "onCompleted");
+
+            var res = AsyncQueryableEx.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Task), (Exception arg0) => default(Task), () => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Expand1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Expand<int>(default(IAsyncQueryable<int>), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Expand<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, IAsyncEnumerable<int>>>)), ane => ane.ParamName == "selector");
+
+            var res = AsyncQueryableEx.Expand<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable());
+            res = res.Take(5);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Expand2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Expand<int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<IAsyncEnumerable<int>>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Expand<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<IAsyncEnumerable<int>>>>)), ane => ane.ParamName == "selector");
+
+            var res = AsyncQueryableEx.Expand<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<IAsyncEnumerable<int>>));
+            res = res.Take(5);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Expand3()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Expand<int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<IAsyncEnumerable<int>>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Expand<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<IAsyncEnumerable<int>>>>)), ane => ane.ParamName == "selector");
+
+            var res = AsyncQueryableEx.Expand<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<IAsyncEnumerable<int>>));
+            res = res.Take(5);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Finally1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Finally<int>(default(IAsyncQueryable<int>), () => { }), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Finally<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Action)), ane => ane.ParamName == "finallyAction");
+
+            var res = AsyncQueryableEx.Finally<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), () => { });
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Finally2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Finally<int>(default(IAsyncQueryable<int>), () => default(Task)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Finally<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<Task>>)), ane => ane.ParamName == "finallyAction");
+
+            var res = AsyncQueryableEx.Finally<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), () => default(Task));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void IgnoreElements1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.IgnoreElements<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.IgnoreElements<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void IsEmptyAsync1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.IsEmptyAsync<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.IsEmptyAsync<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MaxAsync1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxAsync<int>(default(IAsyncQueryable<int>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.MaxAsync<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), Comparer<int>.Default, CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MaxByAsync1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MaxByAsync2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<int>), CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<int>>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<int>), CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MaxByAsync3()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<int>), CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<int>>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<int>), CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MaxByAsync4()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), Comparer<int>.Default, CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MaxByAsync5()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<int>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<int>>>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<int>), Comparer<int>.Default, CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MaxByAsync6()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<int>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<int>>>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MaxByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<int>), Comparer<int>.Default, CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void Merge1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Merge<int>(default(IAsyncQueryable<IAsyncEnumerable<int>>)), ane => ane.ParamName == "sources");
+
+            var res = AsyncQueryableEx.Merge<int>(new IAsyncEnumerable<int>[] { default(IAsyncEnumerable<int>) }.ToAsyncEnumerable().AsAsyncQueryable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void MinAsync1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinAsync<int>(default(IAsyncQueryable<int>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.MinAsync<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), Comparer<int>.Default, CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MinByAsync1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MinByAsync2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<int>), CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<int>>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<int>), CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MinByAsync3()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<int>), CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<int>>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<int>), CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MinByAsync4()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), Comparer<int>.Default, CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MinByAsync5()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(ValueTask<int>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, ValueTask<int>>>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(ValueTask<int>), Comparer<int>.Default, CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void MinByAsync6()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(default(IAsyncQueryable<int>), (int arg0, CancellationToken arg1) => default(ValueTask<int>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, CancellationToken, ValueTask<int>>>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
+
+            var res = AsyncQueryableEx.MinByAsync<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, CancellationToken arg1) => default(ValueTask<int>), Comparer<int>.Default, CancellationToken.None);
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+        }
+
+        [Fact]
+        public void OnErrorResumeNext1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.OnErrorResumeNext<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.OnErrorResumeNext<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
+
+            var res = AsyncQueryableEx.OnErrorResumeNext<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Repeat1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Repeat<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.Repeat<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
+            res = res.Take(5);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Repeat2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Repeat<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.Repeat<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
+            res = res.Take(5);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Retry1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Retry<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.Retry<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Retry2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Retry<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.Retry<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Scan1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "accumulator");
+
+            var res = AsyncQueryableEx.Scan<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => default(int));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Scan2()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => default(ValueTask<int>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, ValueTask<int>>>)), ane => ane.ParamName == "accumulator");
+
+            var res = AsyncQueryableEx.Scan<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => default(ValueTask<int>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Scan3()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int>(default(IAsyncQueryable<int>), (int arg0, int arg1, CancellationToken arg2) => default(ValueTask<int>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, CancellationToken, ValueTask<int>>>)), ane => ane.ParamName == "accumulator");
+
+            var res = AsyncQueryableEx.Scan<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1, CancellationToken arg2) => default(ValueTask<int>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Scan4()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int, int>(default(IAsyncQueryable<int>), 1, (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "accumulator");
+
+            var res = AsyncQueryableEx.Scan<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(int));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Scan5()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int, int>(default(IAsyncQueryable<int>), 1, (int arg0, int arg1) => default(ValueTask<int>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(Expression<Func<int, int, ValueTask<int>>>)), ane => ane.ParamName == "accumulator");
+
+            var res = AsyncQueryableEx.Scan<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(ValueTask<int>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Scan6()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int, int>(default(IAsyncQueryable<int>), 1, (int arg0, int arg1, CancellationToken arg2) => default(ValueTask<int>)), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Scan<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(Expression<Func<int, int, CancellationToken, ValueTask<int>>>)), ane => ane.ParamName == "accumulator");
+
+            var res = AsyncQueryableEx.Scan<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1, CancellationToken arg2) => default(ValueTask<int>));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void SelectMany1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.SelectMany<int, int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.SelectMany<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "other");
+
+            var res = AsyncQueryableEx.SelectMany<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void StartWith1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.StartWith<int>(default(IAsyncQueryable<int>), new int[] { default(int) }), ane => ane.ParamName == "source");
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.StartWith<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(int[])), ane => ane.ParamName == "values");
+
+            var res = AsyncQueryableEx.StartWith<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) });
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+        [Fact]
+        public void Timeout1()
+        {
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.Timeout<int>(default(IAsyncQueryable<int>), default(TimeSpan)), ane => ane.ParamName == "source");
+
+            var res = AsyncQueryableEx.Timeout<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(TimeSpan));
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+        }
+
+    }
+}

+ 484 - 0
Ix.NET/Source/System.Interactive.Async.Providers.Tests/AsyncQueryableExTests.Generated.tt

@@ -0,0 +1,484 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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. 
+
+<#@ template debug="false" hostspecific="false" language="C#" #>
+<#@ assembly name="System.Core" #>
+<#@ assembly name="System.Runtime" #>
+<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net46\System.Threading.Tasks.Extensions.dll" #>
+<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net46\System.Linq.Async.dll" #>
+<#@ assembly name="$(ProjectDir)\..\System.Interactive.Async\bin\$(Configuration)\net46\System.Interactive.Async.dll" #>
+<#@ import namespace="System.Linq" #>
+<#@ import namespace="System.Text" #>
+<#@ import namespace="System.Threading" #>
+<#@ import namespace="System.Threading.Tasks" #>
+<#@ import namespace="System.Collections.Generic" #>
+<#@ output extension=".cs" #>
+<#
+var nullableParameterNames = new[] { "comparer" };
+var failing = new string[0];
+var exclude = new[] { "ForEach", "ForEachAsync", "ToEnumerable", "ToAsyncEnumerable", "ToObservable", "AsAsyncEnumerable" };
+
+var toQuotedImpl = default(Func<Type, int, bool, string>);
+toQuotedImpl = (t, i, b) =>
+{
+var name = t.Name;
+
+if (t.IsGenericType)
+{
+    var genDef = t.GetGenericTypeDefinition();
+    name = genDef.Name.Substring(0, genDef.Name.LastIndexOf('`'));
+
+    var genArgs = "<" + string.Join(", ", t.GetGenericArguments().Select(a => toQuotedImpl(a, i, false))) + ">";
+
+    if (b)
+    {
+        if (name == "Func" || name == "Action")
+        {
+            name = "Expression<" + name + genArgs + ">";
+        }
+        else if (name == "IAsyncEnumerable" && i == 0)
+        {
+            name = "IAsyncQueryable" + genArgs;
+        }
+        else if (name == "IOrderedAsyncEnumerable" && i == 0)
+        {
+            name = "IOrderedAsyncQueryable" + genArgs;
+        }
+        else
+        {
+            name += genArgs;
+        }
+    }
+    else
+    {
+        if (name == "Nullable")
+        {
+            name = genArgs.Substring(1, genArgs.Length - 2) + "?";
+        }
+        else
+        {
+            name += genArgs;
+        }
+    }
+}
+else if (t.IsArray)
+{
+    var elem = toQuotedImpl(t.GetElementType(), i, b);
+    name = elem + "[]";
+}
+else
+{
+    if (t == typeof(int))
+    {
+        name = "int";
+    }
+    else if (t == typeof(long))
+    {
+        name = "long";
+    }
+    else if (t == typeof(float))
+    {
+        name = "float";
+    }
+    else if (t == typeof(double))
+    {
+        name = "double";
+    }
+    else if (t == typeof(decimal))
+    {
+        name = "decimal";
+    }
+    else if (t == typeof(bool))
+    {
+        name = "bool";
+    }
+    else if (t == typeof(object))
+    {
+        name = "object";
+    }
+}
+
+return name;
+};
+
+var toQuoted = new Func<Type, int, string>((t, i) => toQuotedImpl(t, i, true));
+
+var index = new Dictionary<string, int>();
+#>
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class AsyncQueryableTests
+    {
+<#
+// NOTE: Just including extension methods
+foreach (var m in typeof(AsyncEnumerableEx).GetMethods()
+                        .Where(m => m.IsStatic)
+                        .Where(m => !exclude.Contains(m.Name))
+                        .Where(m => m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))
+                        .Where(m =>
+                        {
+                            var p0 = m.GetParameters()[0].ParameterType;
+                            if (p0.IsGenericType)
+                            {
+                                var p0d = p0.GetGenericTypeDefinition();
+                                return p0d == typeof(IAsyncEnumerable<>) || p0d == typeof(IOrderedAsyncEnumerable<>);
+                            }
+
+                            return false;
+                        })
+                        .OrderBy(m => m.Name)
+                        .ThenBy(m => m.IsGenericMethod ? m.GetGenericArguments().Length : 0)
+                        .ThenBy(m => m.GetParameters().Length)
+                        .ThenBy(m => string.Join(", ", m.GetParameters().Select(p => p.Name))))
+{
+    var genArgs = m.GetGenericArguments();
+
+    var ret = toQuoted(m.ReturnType, 0);
+    var name = m.Name;
+
+    if (genArgs.Length > 0)
+    {
+        name += "<" + string.Join(", ", genArgs.Select(a => a.Name)) + ">";
+    }
+
+    var isParams = false;
+    var parCount = m.GetParameters().Length;
+
+    if (parCount != 0)
+    {
+        if (m.GetParameters().Last().IsDefined(typeof(ParamArrayAttribute), true))
+        {
+            isParams = true;
+        }
+    }
+
+    var pars = string.Join(", ", m.GetParameters().Select((p, i) => (i == parCount - 1 && isParams ? "params " : "") + toQuoted(p.ParameterType, i) + " " + p.Name));
+
+    if (m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))
+    {
+        pars = "this " + pars;
+    }
+
+    var mtd = "(MethodInfo)MethodBase.GetCurrentMethod()";
+
+    if (m.IsGenericMethod)
+    {
+        mtd = "(" + mtd + ").MakeGenericMethod(" + string.Join(", ", genArgs.Select(a => "typeof(" + a.Name + ")")) + ")";
+    }
+
+    var provider = m.GetParameters()[0].Name + ".Provider";
+    var factory = "";
+    var rem = "";
+    var cast = "";
+    var quotedArgs = new List<string>();
+
+    if (m.ReturnType.IsGenericType)
+    {
+        var td = m.ReturnType.GetGenericTypeDefinition();
+
+        if (td.Name.EndsWith("Task`1")) // NB: Covers Task and ValueTask
+        {
+            factory = "ExecuteAsync<" + toQuotedImpl(m.ReturnType.GetGenericArguments()[0], -1, false) + ">";
+
+            var last = m.GetParameters().Last();
+            if (last.ParameterType == typeof(CancellationToken))
+            {
+                rem = ", " + last.Name;
+            }
+            else
+            {
+                rem = ", CancellationToken.None";
+            }
+        }
+        else if (td == typeof(IAsyncEnumerable<>) || td == typeof(IOrderedAsyncEnumerable<>))
+        {
+            factory = "CreateQuery<" + toQuotedImpl(m.ReturnType.GetGenericArguments()[0], -1, false) + ">";
+
+            if (td == typeof(IOrderedAsyncEnumerable<>))
+            {
+                cast = "(" + toQuoted(m.ReturnType, 0) + ")";
+            }
+        }
+    }
+
+    var n = 0;
+    foreach (var p in m.GetParameters())
+    {
+        var pt = p.ParameterType;
+
+        var add = false;
+
+        if (pt.IsGenericType)
+        {
+            var ptd = pt.GetGenericTypeDefinition();
+
+            if (ptd == typeof(IAsyncEnumerable<>) || ptd == typeof(IOrderedAsyncEnumerable<>))
+            {
+                if (n == 0)
+                {
+                    quotedArgs.Add(p.Name + ".Expression");
+                }
+                else
+                {
+                    quotedArgs.Add("GetSourceExpression(" + p.Name + ")");
+                }
+                add = true;
+            }
+            else if (ptd.Name.StartsWith("Func") || ptd.Name.StartsWith("Action"))
+            {
+                quotedArgs.Add(p.Name);
+                add = true;
+            }
+        }
+        
+        if (!add)
+        {
+            quotedArgs.Add("Expression.Constant(" + p.Name + ", typeof(" + toQuoted(pt, -1) + "))");
+        }
+
+        n++;
+    }
+
+    var expr = "Expression.Call(" + mtd + ", " + string.Join(", ", quotedArgs) + ")";
+
+    var testName = m.Name;
+
+    var num = 0;
+    if (!index.TryGetValue(testName, out num))
+    {
+        index[testName] = 0;
+    }
+
+    index[testName] = num + 1;
+
+    testName += (num + 1);
+#>
+        [Fact]
+        public void <#=testName#>()
+        {
+<#
+var indexes = new List<int>();
+var j = 0;
+foreach (var p in m.GetParameters())
+{
+    if (!p.ParameterType.IsValueType && !p.ParameterType.IsGenericParameter && !nullableParameterNames.Contains(p.Name))
+    {
+        indexes.Add(j);
+    }
+
+    j++;
+}
+
+var tm = m;
+
+if (tm.IsGenericMethodDefinition)
+{
+    tm = m.MakeGenericMethod(m.GetGenericArguments().Select(a =>
+    {
+        var cs = a.GetGenericParameterConstraints();
+        if (cs.Length > 0)
+        {
+            var bc = cs.FirstOrDefault(c => c.IsClass);
+            if (bc != null)
+            {
+                return bc;
+            }
+        }
+
+        return typeof(int);
+    }).ToArray());
+}
+
+var opName = tm.Name;
+
+if (tm.IsGenericMethod)
+{
+    opName += "<" + string.Join(", ", tm.GetGenericArguments().Select(a => toQuotedImpl(a, -1, false))) + ">";
+}
+
+var getVal = default(Func<Type, int, string>);
+getVal = (tp, pos) =>
+{
+    if (tp.IsGenericType)
+    {
+        var tpd = tp.GetGenericTypeDefinition();
+
+        if (tpd == typeof(IAsyncEnumerable<>))
+        {
+            var tpa = tp.GetGenericArguments()[0];
+            var et = toQuotedImpl(tpa, -1, false);
+            var res = "new " + et + "[] { default(" + et + ") }.ToAsyncEnumerable()";
+
+            if (pos == 0)
+            {
+                res += ".AsAsyncQueryable()";
+            }
+
+            return res;
+        }
+        else if (tpd == typeof(IOrderedAsyncEnumerable<>))
+        {
+            var tpa = tp.GetGenericArguments()[0];
+            var res = "new " + toQuotedImpl(tpa, -1, false) + "[0].ToAsyncEnumerable()";
+
+            if (pos == 0)
+            {
+                res += ".AsAsyncQueryable()";
+            }
+
+            return res + ".OrderBy(x => x)";
+        }
+        else if (tpd.Name.StartsWith("Func"))
+        {
+            var inv = tp.GetMethod("Invoke");
+                
+            var largs = string.Join(", ", inv.GetParameters().Select((lp, lpi) => toQuoted(lp.ParameterType, -1) + " arg" + lpi).ToArray());
+
+            var lret = "default(" + toQuoted(inv.ReturnType, -1) + ")";
+
+            if (inv.ReturnType.IsGenericType)
+            {
+                if (inv.ReturnType.GetGenericTypeDefinition() == typeof(IAsyncEnumerable<>))
+                {
+                    var tpa = inv.ReturnType.GetGenericArguments()[0];
+                    var et = toQuotedImpl(tpa, -1, false);
+                    lret = "new " + et + "[] { default(" + et + ") }.ToAsyncEnumerable()";
+                }
+            }
+            else if (inv.ReturnType == typeof(bool))
+            {
+                lret = "true";
+            }
+
+            return "(" + largs + ") => " + lret;
+        }
+        else if (tpd.Name.StartsWith("Action"))
+        {
+            var inv = tp.GetMethod("Invoke");
+                
+            var largs = string.Join(", ", inv.GetParameters().Select((lp, lpi) => toQuoted(lp.ParameterType, -1) + " arg" + lpi).ToArray());
+            var lret = "Console.WriteLine()";
+
+            return "(" + largs + ") => " + lret;
+        }
+        else if (tpd == typeof(IEqualityComparer<>))
+        {
+            var tpa = tp.GetGenericArguments()[0];
+
+            return "EqualityComparer<" + toQuotedImpl(tpa, -1, false) + ">.Default";
+        }
+        else if (tpd == typeof(IComparer<>))
+        {
+            var tpa = tp.GetGenericArguments()[0];
+
+            return "Comparer<" + toQuotedImpl(tpa, -1, false) + ">.Default";
+        }
+        else if (tpd == typeof(IObserver<>))
+        {
+            var tpa = tp.GetGenericArguments()[0];
+
+            return "new NopObserver<" + toQuotedImpl(tpa, -1, false) + ">()";
+        }
+    }
+    else if (tp == typeof(CancellationToken))
+    {
+        return "CancellationToken.None";
+    }
+    else if (tp == typeof(Action))
+    {
+        return "() => { }";
+    }
+    else if (tp.IsArray)
+    {
+        var tpa = tp.GetElementType();
+        var et = toQuotedImpl(tpa, -1, false);
+
+        return "new " + et + "[] { default(" + et + ") }";
+    }
+    else if (tp == typeof(int))
+    {
+        return "1";
+    }
+
+    return "default(" + toQuoted(tp, pos) + ")";
+};
+
+var vals = tm.GetParameters().Select((p, i) => getVal(p.ParameterType, i)).ToArray();
+var nulls = tm.GetParameters().Select((p, i) => "default(" + toQuoted(p.ParameterType, i) + ")").ToArray();
+
+var len = vals.Length;
+
+if (indexes.Count != 0)
+{
+    foreach (var idx in indexes)
+    {
+        var args = string.Join(", ", Enumerable.Range(0, len).Select(k => k == idx ? nulls[k] : vals[k]).ToArray());
+        var nullArg = tm.GetParameters()[idx].Name;
+#>
+            AssertEx.Throws<ArgumentNullException>(() => AsyncQueryableEx.<#=opName#>(<#=args#>), ane => ane.ParamName == "<#=nullArg#>");
+<#
+    }
+#>
+
+<#
+}
+
+{
+    var args = string.Join(", ", vals);
+#>
+            var res = AsyncQueryableEx.<#=opName#>(<#=args#>);
+<#
+    var tmRet = tm.ReturnType;
+
+    if (tmRet.IsGenericType)
+    {
+        tmRet = tmRet.GetGenericTypeDefinition();
+    }
+
+    if (tm.Name == "Repeat" || tm.Name == "Expand")
+    {
+#>
+            res = res.Take(5);
+<#
+    }
+
+    if (!failing.Contains(tm.Name))
+    {
+        if (tmRet.Name.EndsWith("Task`1")) // NB: Covers Task and ValueTask
+        {
+#>
+            AssertEx.SucceedOrFailProper(() => res.Wait());
+<#
+        }
+        else if (tmRet == typeof(IAsyncEnumerable<>))
+        {
+#>
+            var task = res.ForEachAsync(_ => { });
+            AssertEx.SucceedOrFailProper(() => task.Wait());
+<#
+        }
+    }
+    else
+    {
+#>
+            // TODO: investigate test hang
+<#
+    }
+}
+#>
+        }
+
+<#
+}
+#>
+    }
+}

+ 1 - 0
Ix.NET/Source/System.Interactive.Async.Tests/NopObserver.cs → Ix.NET/Source/System.Interactive.Async.Providers.Tests/NopObserver.cs

@@ -1,6 +1,7 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // 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;
 
 namespace Tests

+ 50 - 0
Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj

@@ -0,0 +1,50 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFrameworks>netcoreapp2.1;net461;netcoreapp3.0</TargetFrameworks>
+    <NoWarn>$(NoWarn);CS0618</NoWarn>
+  </PropertyGroup>
+
+
+  <ItemGroup>
+    <Content Include="xunit.runner.json">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\System.Interactive.Async.Providers\System.Interactive.Async.Providers.csproj" />
+    <ProjectReference Include="..\System.Linq.Async\System.Linq.Async.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0-preview-20190203-03" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="FluentAssertions" Version="5.6.0" />
+
+    <PackageReference Include="xunit" Version="2.4.1" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Update="AsyncQueryableExTests.Generated.tt">
+      <LastGenOutput>AsyncQueryableExTests.Generated.cs</LastGenOutput>
+      <Generator>TextTemplatingFileGenerator</Generator>
+    </None>
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Update="AsyncQueryableExTests.Generated.cs">
+      <DesignTime>True</DesignTime>
+      <AutoGen>True</AutoGen>
+      <DependentUpon>AsyncQueryableExTests.Generated.tt</DependentUpon>
+    </Compile>
+  </ItemGroup>
+
+  <ItemGroup>
+    <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
+  </ItemGroup>
+
+</Project>

+ 13 - 0
Ix.NET/Source/System.Interactive.Async.Providers.Tests/ValueTaskExtensions.cs

@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Threading.Tasks;
+
+namespace Tests
+{
+    public static class ValueTaskExtensions
+    {
+        public static void Wait<T>(this ValueTask<T> task) => task.AsTask().Wait();
+    }
+}

+ 5 - 0
Ix.NET/Source/System.Interactive.Async.Providers.Tests/xunit.runner.json

@@ -0,0 +1,5 @@
+{
+  "diagnosticMessages": true,
+  "methodDisplay": "classAndMethod",
+  "longRunningTestSeconds": 30 
+}

+ 0 - 4608
Ix.NET/Source/System.Interactive.Async.Providers/AsyncQueryable.Generated.cs

@@ -1,4608 +0,0 @@
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-	public static partial class AsyncQueryable
-	{
-		public static Task<TSource> Aggregate<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (accumulator == null)
-				throw new ArgumentNullException("accumulator");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))), source.Expression, accumulator), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (accumulator == null)
-				throw new ArgumentNullException("accumulator");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Aggregate<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (accumulator == null)
-				throw new ArgumentNullException("accumulator");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, TSource>>), default(CancellationToken))), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, Expression<Func<TAccumulate, TResult>> resultSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (accumulator == null)
-				throw new ArgumentNullException("accumulator");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate, TResult>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>), default(Expression<Func<TAccumulate, TResult>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate), typeof(TResult)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (accumulator == null)
-				throw new ArgumentNullException("accumulator");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, Expression<Func<TAccumulate, TResult>> resultSelector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (accumulator == null)
-				throw new ArgumentNullException("accumulator");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate, TResult>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>), default(Expression<Func<TAccumulate, TResult>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate), typeof(TResult)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<bool> All<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.All<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<bool> All<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.All<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Append<TSource>(this IAsyncQueryable<TSource> source, TSource element)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Append<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(element, typeof(TSource))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(element, typeof(TSource))));
-#endif
-		}
-
-		public static Task<double> Average(this IAsyncQueryable<int> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Average(this IAsyncQueryable<int?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Average(this IAsyncQueryable<long> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Average(this IAsyncQueryable<long?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Average(this IAsyncQueryable<double> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Average(this IAsyncQueryable<double?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float> Average(this IAsyncQueryable<float> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float?> Average(this IAsyncQueryable<float?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal> Average(this IAsyncQueryable<decimal> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal?> Average(this IAsyncQueryable<decimal?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Average(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Average(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Average(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Average(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Average(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Average(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float> Average(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float?> Average(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal> Average(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal?> Average(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<IList<TSource>> Buffer<TSource>(this IAsyncQueryable<TSource> source, int count)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.Buffer<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
-#else
-			return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
-#endif
-		}
-
-		public static IAsyncQueryable<IList<TSource>> Buffer<TSource>(this IAsyncQueryable<TSource> source, int count, int skip)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.Buffer<TSource>(default(IAsyncQueryable<TSource>), default(int), default(int))), source.Expression, Expression.Constant(count, typeof(int)), Expression.Constant(skip, typeof(int))));
-#else
-			return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)), Expression.Constant(skip, typeof(int))));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> Cast<TResult>(this IAsyncQueryable<object> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Cast<TResult>(default(IAsyncQueryable<object>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, IAsyncEnumerable<TSource>>> handler)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (handler == null)
-				throw new ArgumentNullException("handler");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Catch<TSource, TException>(default(IAsyncQueryable<TSource>), default(Expression<Func<TException, IAsyncEnumerable<TSource>>>))), source.Expression, handler));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), source.Expression, handler));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Catch<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Catch<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Concat<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Concat<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
-#endif
-		}
-
-		public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Contains<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(value, typeof(TSource))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Contains<TSource>(default(IAsyncQueryable<TSource>), default(TSource), default(IEqualityComparer<TSource>))), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Contains<TSource>(default(IAsyncQueryable<TSource>), default(TSource), default(CancellationToken))), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Contains<TSource>(default(IAsyncQueryable<TSource>), default(TSource), default(IEqualityComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> DefaultIfEmpty<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DefaultIfEmpty<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> DefaultIfEmpty<TSource>(this IAsyncQueryable<TSource> source, TSource defaultValue)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DefaultIfEmpty<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(defaultValue, typeof(TSource))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Distinct<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Distinct<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource>(default(IAsyncQueryable<TSource>), default(IEqualityComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DistinctUntilChanged<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DistinctUntilChanged<TSource>(default(IAsyncQueryable<TSource>), default(IEqualityComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (onNext == null)
-				throw new ArgumentNullException("onNext");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>))), source.Expression, onNext));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, IObserver<TSource> observer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (observer == null)
-				throw new ArgumentNullException("observer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(IObserver<TSource>))), source.Expression, Expression.Constant(observer, typeof(IObserver<TSource>))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(observer, typeof(IObserver<TSource>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Action onCompleted)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (onNext == null)
-				throw new ArgumentNullException("onNext");
-			if (onCompleted == null)
-				throw new ArgumentNullException("onCompleted");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Action))), source.Expression, onNext, Expression.Constant(onCompleted, typeof(Action))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, Expression.Constant(onCompleted, typeof(Action))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (onNext == null)
-				throw new ArgumentNullException("onNext");
-			if (onError == null)
-				throw new ArgumentNullException("onError");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>))), source.Expression, onNext, onError));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError, Action onCompleted)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (onNext == null)
-				throw new ArgumentNullException("onNext");
-			if (onError == null)
-				throw new ArgumentNullException("onError");
-			if (onCompleted == null)
-				throw new ArgumentNullException("onCompleted");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>), default(Action))), source.Expression, onNext, onError, Expression.Constant(onCompleted, typeof(Action))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError, Expression.Constant(onCompleted, typeof(Action))));
-#endif
-		}
-
-		public static Task<TSource> ElementAt<TSource>(this IAsyncQueryable<TSource> source, int index)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ElementAt<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> ElementAt<TSource>(this IAsyncQueryable<TSource> source, int index, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ElementAt<TSource>(default(IAsyncQueryable<TSource>), default(int), default(CancellationToken))), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncQueryable<TSource> source, int index)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ElementAtOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncQueryable<TSource> source, int index, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ElementAtOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(int), default(CancellationToken))), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Except<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Except<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Except<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Except<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TSource>>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Expand<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TSource>>>))), source.Expression, selector));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Finally<TSource>(this IAsyncQueryable<TSource> source, Action finallyAction)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (finallyAction == null)
-				throw new ArgumentNullException("finallyAction");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Finally<TSource>(default(IAsyncQueryable<TSource>), default(Action))), source.Expression, Expression.Constant(finallyAction, typeof(Action))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(finallyAction, typeof(Action))));
-#endif
-		}
-
-		public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<IAsyncGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
-#else
-			return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
-#endif
-		}
-
-		public static IAsyncQueryable<IAsyncGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))), source.Expression, keySelector, elementSelector));
-#else
-			return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector));
-#endif
-		}
-
-		public static IAsyncQueryable<IAsyncGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#else
-			return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>> resultSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>>))), source.Expression, keySelector, resultSelector));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector));
-#endif
-		}
-
-		public static IAsyncQueryable<IAsyncGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#else
-			return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IAsyncEnumerable<TElement>, TResult>> resultSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<TKey, IAsyncEnumerable<TElement>, TResult>>))), source.Expression, keySelector, elementSelector, resultSelector));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IAsyncEnumerable<TElement>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<TKey, IAsyncEnumerable<TElement>, TResult>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IAsyncEnumerable<TInner>, TResult>> resultSelector)
-		{
-			if (outer == null)
-				throw new ArgumentNullException("outer");
-			if (inner == null)
-				throw new ArgumentNullException("inner");
-			if (outerKeySelector == null)
-				throw new ArgumentNullException("outerKeySelector");
-			if (innerKeySelector == null)
-				throw new ArgumentNullException("innerKeySelector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-
-#if CRIPPLED_REFLECTION
-			return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoin<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, TKey>>), default(Expression<Func<TInner, TKey>>), default(Expression<Func<TOuter, IAsyncEnumerable<TInner>, TResult>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
-#else
-			return outer.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IAsyncEnumerable<TInner>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
-		{
-			if (outer == null)
-				throw new ArgumentNullException("outer");
-			if (inner == null)
-				throw new ArgumentNullException("inner");
-			if (outerKeySelector == null)
-				throw new ArgumentNullException("outerKeySelector");
-			if (innerKeySelector == null)
-				throw new ArgumentNullException("innerKeySelector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoin<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, TKey>>), default(Expression<Func<TInner, TKey>>), default(Expression<Func<TOuter, IAsyncEnumerable<TInner>, TResult>>), default(IEqualityComparer<TKey>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#else
-			return outer.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> IgnoreElements<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.IgnoreElements<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Intersect<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Intersect<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Intersect<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Intersect<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#endif
-		}
-
-		public static Task<bool> IsEmpty<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.IsEmpty<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<bool> IsEmpty<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.IsEmpty<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)
-		{
-			if (outer == null)
-				throw new ArgumentNullException("outer");
-			if (inner == null)
-				throw new ArgumentNullException("inner");
-			if (outerKeySelector == null)
-				throw new ArgumentNullException("outerKeySelector");
-			if (innerKeySelector == null)
-				throw new ArgumentNullException("innerKeySelector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-
-#if CRIPPLED_REFLECTION
-			return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Join<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, TKey>>), default(Expression<Func<TInner, TKey>>), default(Expression<Func<TOuter, TInner, TResult>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
-#else
-			return outer.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
-		{
-			if (outer == null)
-				throw new ArgumentNullException("outer");
-			if (inner == null)
-				throw new ArgumentNullException("inner");
-			if (outerKeySelector == null)
-				throw new ArgumentNullException("outerKeySelector");
-			if (innerKeySelector == null)
-				throw new ArgumentNullException("innerKeySelector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Join<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, TKey>>), default(Expression<Func<TInner, TKey>>), default(Expression<Func<TOuter, TInner, TResult>>), default(IEqualityComparer<TKey>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#else
-			return outer.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
-#endif
-		}
-
-		public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int> Max(this IAsyncQueryable<int> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long> Max(this IAsyncQueryable<long> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Max(this IAsyncQueryable<double> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float> Max(this IAsyncQueryable<float> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal> Max(this IAsyncQueryable<decimal> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int?> Max(this IAsyncQueryable<int?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long?> Max(this IAsyncQueryable<long?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Max(this IAsyncQueryable<double?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float?> Max(this IAsyncQueryable<float?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal?> Max(this IAsyncQueryable<decimal?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int> Max(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long> Max(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Max(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float> Max(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal> Max(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int?> Max(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long?> Max(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Max(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float?> Max(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal?> Max(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<IList<TSource>> MaxBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MaxBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<IList<TSource>> MaxBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MaxBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<IList<TSource>> MaxBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MaxBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<IList<TSource>> MaxBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MaxBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int> Min(this IAsyncQueryable<int> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long> Min(this IAsyncQueryable<long> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Min(this IAsyncQueryable<double> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float> Min(this IAsyncQueryable<float> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal> Min(this IAsyncQueryable<decimal> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int?> Min(this IAsyncQueryable<int?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long?> Min(this IAsyncQueryable<long?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Min(this IAsyncQueryable<double?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float?> Min(this IAsyncQueryable<float?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal?> Min(this IAsyncQueryable<decimal?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int> Min(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long> Min(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Min(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float> Min(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal> Min(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int?> Min(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long?> Min(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Min(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float?> Min(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal?> Min(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<IList<TSource>> MinBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MinBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<IList<TSource>> MinBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MinBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<IList<TSource>> MinBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MinBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<IList<TSource>> MinBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MinBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<TType> OfType<TType>(this IAsyncQueryable<object> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TType>(Expression.Call(InfoOf(() => AsyncQueryable.OfType<TType>(default(IAsyncQueryable<object>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TType>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TType)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> OnErrorResumeNext<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OnErrorResumeNext<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
-#endif
-		}
-
-		public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
-#else
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
-#endif
-		}
-
-		public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
-#else
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
-#endif
-		}
-
-		public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescending<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
-#else
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
-#endif
-		}
-
-		public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescending<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
-#else
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Prepend<TSource>(this IAsyncQueryable<TSource> source, TSource element)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Prepend<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(element, typeof(TSource))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(element, typeof(TSource))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Repeat<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source, int count)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Repeat<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Retry<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Retry<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Retry<TSource>(this IAsyncQueryable<TSource> source, int retryCount)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Retry<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(retryCount, typeof(int))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(retryCount, typeof(int))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Reverse<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Reverse<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (accumulator == null)
-				throw new ArgumentNullException("accumulator");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Scan<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))), source.Expression, accumulator));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator));
-#endif
-		}
-
-		public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (accumulator == null)
-				throw new ArgumentNullException("accumulator");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryable.Scan<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
-#else
-			return source.Provider.CreateQuery<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, TResult>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, TResult>>))), source.Expression, selector));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
-#endif
-		}
-
-		public static IAsyncQueryable<TOther> SelectMany<TSource, TOther>(this IAsyncQueryable<TSource> source, IAsyncEnumerable<TOther> other)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (other == null)
-				throw new ArgumentNullException("other");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TOther>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TOther>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TOther>))), source.Expression, GetSourceExpression(other)));
-#else
-			return source.Provider.CreateQuery<TOther>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)), source.Expression, GetSourceExpression(other)));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TResult>>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TResult>>>))), source.Expression, selector));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, IAsyncEnumerable<TResult>>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, IAsyncEnumerable<TResult>>>))), source.Expression, selector));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TCollection>>> selector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TCollection, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TCollection>>>), default(Expression<Func<TSource, TCollection, TResult>>))), source.Expression, selector, resultSelector));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, IAsyncEnumerable<TCollection>>> selector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-			if (resultSelector == null)
-				throw new ArgumentNullException("resultSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TCollection, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, IAsyncEnumerable<TCollection>>>), default(Expression<Func<TSource, TCollection, TResult>>))), source.Expression, selector, resultSelector));
-#else
-			return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
-#endif
-		}
-
-		public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)), CancellationToken.None);
-#else
-			return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)), CancellationToken.None);
-#endif
-		}
-
-		public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))), CancellationToken.None);
-#else
-			return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, CancellationToken cancellationToken)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(CancellationToken))), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>), default(CancellationToken))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Skip<TSource>(this IAsyncQueryable<TSource> source, int count)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Skip<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> SkipLast<TSource>(this IAsyncQueryable<TSource> source, int count)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipLast<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> StartWith<TSource>(this IAsyncQueryable<TSource> source, params TSource[] values)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (values == null)
-				throw new ArgumentNullException("values");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.StartWith<TSource>(default(IAsyncQueryable<TSource>), default(TSource[]))), source.Expression, Expression.Constant(values, typeof(TSource[]))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(values, typeof(TSource[]))));
-#endif
-		}
-
-		public static Task<int> Sum(this IAsyncQueryable<int> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long> Sum(this IAsyncQueryable<long> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Sum(this IAsyncQueryable<double> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float> Sum(this IAsyncQueryable<float> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal> Sum(this IAsyncQueryable<decimal> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int?> Sum(this IAsyncQueryable<int?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long?> Sum(this IAsyncQueryable<long?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Sum(this IAsyncQueryable<double?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float?> Sum(this IAsyncQueryable<float?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal?> Sum(this IAsyncQueryable<decimal?> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int> Sum(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long> Sum(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Sum(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float> Sum(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal> Sum(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int?> Sum(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long?> Sum(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Sum(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float?> Sum(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal?> Sum(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Take<TSource>(this IAsyncQueryable<TSource> source, int count)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Take<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> TakeLast<TSource>(this IAsyncQueryable<TSource> source, int count)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeLast<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
-#endif
-		}
-
-		public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenBy<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
-#else
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
-#endif
-		}
-
-		public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenBy<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
-#else
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
-#endif
-		}
-
-		public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescending<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
-#else
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
-#endif
-		}
-
-		public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescending<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
-#else
-			return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
-#endif
-		}
-
-		public static Task<TSource[]> ToArray<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(InfoOf(() => AsyncQueryable.ToArray<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<TSource[]> ToArray<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(InfoOf(() => AsyncQueryable.ToArray<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))), source.Expression, keySelector, elementSelector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<List<TSource>> ToList<TSource>(this IAsyncQueryable<TSource> source)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToList<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
-#endif
-		}
-
-		public static Task<List<TSource>> ToList<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToList<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))), source.Expression, keySelector, elementSelector), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector), CancellationToken.None);
-#endif
-		}
-
-		public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
-#else
-			return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
-#endif
-		}
-
-		public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (keySelector == null)
-				throw new ArgumentNullException("keySelector");
-			if (elementSelector == null)
-				throw new ArgumentNullException("elementSelector");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#else
-			return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Union<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Union<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Union<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-			if (comparer == null)
-				throw new ArgumentNullException("comparer");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Union<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#else
-			return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
-#endif
-		}
-
-		public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
-		{
-			if (source == null)
-				throw new ArgumentNullException("source");
-			if (predicate == null)
-				throw new ArgumentNullException("predicate");
-
-#if CRIPPLED_REFLECTION
-			return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
-#else
-			return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
-#endif
-		}
-
-		public static IAsyncQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IAsyncQueryable<TFirst> first, IAsyncEnumerable<TSecond> second, Expression<Func<TFirst, TSecond, TResult>> selector)
-		{
-			if (first == null)
-				throw new ArgumentNullException("first");
-			if (second == null)
-				throw new ArgumentNullException("second");
-			if (selector == null)
-				throw new ArgumentNullException("selector");
-
-#if CRIPPLED_REFLECTION
-			return first.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Zip<TFirst, TSecond, TResult>(default(IAsyncQueryable<TFirst>), default(IAsyncEnumerable<TSecond>), default(Expression<Func<TFirst, TSecond, TResult>>))), first.Expression, GetSourceExpression(second), selector));
-#else
-			return first.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector));
-#endif
-		}
-
-	}
-}

+ 0 - 277
Ix.NET/Source/System.Interactive.Async.Providers/AsyncQueryable.Generated.tt

@@ -1,277 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ assembly name="System.Core" #>
-<#@ assembly name="$(ProjectDir)\..\System.Interactive.Async\bin\$(Configuration)\net45\System.Interactive.Async.dll" #>
-<#@ import namespace="System.Linq" #>
-<#@ import namespace="System.Text" #>
-<#@ import namespace="System.Threading" #>
-<#@ import namespace="System.Threading.Tasks" #>
-<#@ import namespace="System.Collections.Generic" #>
-<#@ output extension=".cs" #>
-<#
-var exclude = new[] { "ForEach", "ForEachAsync", "ToEnumerable", "ToAsyncEnumerable", "ToObservable", "AsAsyncEnumerable" };
-
-var toQuotedImpl = default(Func<Type, int, bool, string>);
-toQuotedImpl = (t, i, b) =>
-{
-var name = t.Name;
-
-if (t.IsGenericType)
-{
-	var genDef = t.GetGenericTypeDefinition();
-	name = genDef.Name.Substring(0, genDef.Name.LastIndexOf('`'));
-
-	var genArgs = "<" + string.Join(", ", t.GetGenericArguments().Select(a => toQuotedImpl(a, i, false))) + ">";
-
-	if (b)
-	{
-		if (name == "Func" || name == "Action")
-		{
-			name = "Expression<" + name + genArgs + ">";
-		}
-		else if (name == "IAsyncEnumerable" && i == 0)
-		{
-			name = "IAsyncQueryable" + genArgs;
-		}
-		else if (name == "IOrderedAsyncEnumerable" && i == 0)
-		{
-			name = "IOrderedAsyncQueryable" + genArgs;
-		}
-		else
-		{
-			name += genArgs;
-		}
-	}
-	else
-	{
-		if (name == "Nullable")
-		{
-			name = genArgs.Substring(1, genArgs.Length - 2) + "?";
-		}
-		else
-		{
-			name += genArgs;
-		}
-	}
-}
-else if (t.IsArray)
-{
-	var elem = toQuotedImpl(t.GetElementType(), i, b);
-	name = elem + "[]";
-}
-else
-{
-	if (t == typeof(int))
-	{
-		name = "int";
-	}
-	else if (t == typeof(long))
-	{
-		name = "long";
-	}
-	else if (t == typeof(float))
-	{
-		name = "float";
-	}
-	else if (t == typeof(double))
-	{
-		name = "double";
-	}
-	else if (t == typeof(decimal))
-	{
-		name = "decimal";
-	}
-	else if (t == typeof(bool))
-	{
-		name = "bool";
-	}
-	else if (t == typeof(object))
-	{
-		name = "object";
-	}
-}
-
-return name;
-};
-
-var toQuoted = new Func<Type, int, string>((t, i) => toQuotedImpl(t, i, true));
-#>
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-	public static partial class AsyncQueryable
-	{
-<#
-// NOTE: Just including extension methods
-foreach (var m in typeof(AsyncEnumerable).GetMethods()
-						.Where(m => m.IsStatic)
-						.Where(m => !exclude.Contains(m.Name))
-						.Where(m => m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))
-						.Where(m =>
-						{
-							var p0 = m.GetParameters()[0].ParameterType;
-							if (p0.IsGenericType)
-							{
-								var p0d = p0.GetGenericTypeDefinition();
-								return p0d == typeof(IAsyncEnumerable<>) || p0d == typeof(IOrderedAsyncEnumerable<>);
-							}
-
-							return false;
-						})
-						.OrderBy(m => m.Name)
-						.ThenBy(m => m.GetParameters().Length))
-{
-	var genArgs = m.GetGenericArguments();
-
-	var ret = toQuoted(m.ReturnType, 0);
-	var name = m.Name;
-
-	if (genArgs.Length > 0)
-	{
-		name += "<" + string.Join(", ", genArgs.Select(a => a.Name)) + ">";
-	}
-
-	var isParams = false;
-	var parCount = m.GetParameters().Length;
-
-	if (parCount != 0)
-	{
-		if (m.GetParameters().Last().IsDefined(typeof(ParamArrayAttribute), true))
-		{
-			isParams = true;
-		}
-	}
-
-	var pars = string.Join(", ", m.GetParameters().Select((p, i) => (i == parCount - 1 && isParams ? "params " : "") + toQuoted(p.ParameterType, i) + " " + p.Name));
-	var quotedPars = string.Join(", ", m.GetParameters().Select((p, i) => "default(" + toQuoted(p.ParameterType, i) + ")"));
-
-	if (m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))
-	{
-		pars = "this " + pars;
-	}
-
-	var mtd = "(MethodInfo)MethodBase.GetCurrentMethod()";
-
-	if (m.IsGenericMethod)
-	{
-		mtd = "(" + mtd + ").MakeGenericMethod(" + string.Join(", ", genArgs.Select(a => "typeof(" + a.Name + ")")) + ")";
-	}
-
-	var provider = m.GetParameters()[0].Name + ".Provider";
-	var factory = "";
-	var rem = "";
-	var cast = "";
-	var quotedArgs = new List<string>();
-
-	if (m.ReturnType.IsGenericType)
-	{
-		var td = m.ReturnType.GetGenericTypeDefinition();
-
-		if (td == typeof(Task<>))
-		{
-			factory = "ExecuteAsync<" + toQuotedImpl(m.ReturnType.GetGenericArguments()[0], -1, false) + ">";
-
-			var last = m.GetParameters().Last();
-			if (last.ParameterType == typeof(CancellationToken))
-			{
-				rem = ", " + last.Name;
-			}
-			else
-			{
-				rem = ", CancellationToken.None";
-			}
-		}
-		else if (td == typeof(IAsyncEnumerable<>) || td == typeof(IOrderedAsyncEnumerable<>))
-		{
-			factory = "CreateQuery<" + toQuotedImpl(m.ReturnType.GetGenericArguments()[0], -1, false) + ">";
-
-			if (td == typeof(IOrderedAsyncEnumerable<>))
-			{
-				cast = "(" + toQuoted(m.ReturnType, 0) + ")";
-			}
-		}
-	}
-
-	var n = 0;
-	foreach (var p in m.GetParameters())
-	{
-		var pt = p.ParameterType;
-
-		var add = false;
-
-		if (pt.IsGenericType)
-		{
-			var ptd = pt.GetGenericTypeDefinition();
-
-			if (ptd == typeof(IAsyncEnumerable<>) || ptd == typeof(IOrderedAsyncEnumerable<>))
-			{
-				if (n == 0)
-				{
-					quotedArgs.Add(p.Name + ".Expression");
-				}
-				else
-				{
-					quotedArgs.Add("GetSourceExpression(" + p.Name + ")");
-				}
-				add = true;
-			}
-			else if (ptd.Name.StartsWith("Func") || ptd.Name.StartsWith("Action"))
-			{
-				quotedArgs.Add(p.Name);
-				add = true;
-			}
-		}
-		
-		if (!add)
-		{
-			quotedArgs.Add("Expression.Constant(" + p.Name + ", typeof(" + toQuoted(pt, -1) + "))");
-		}
-
-		n++;
-	}
-
-	var expr = "Expression.Call(" + mtd + ", " + string.Join(", ", quotedArgs) + ")";
-
-	var infoofmtd = "InfoOf(() => AsyncQueryable." + name + "(" + quotedPars + "))";
-	var infoofexpr = "Expression.Call(" + infoofmtd + ", " + string.Join(", ", quotedArgs) + ")";
-#>
-		public static <#=ret#> <#=name#>(<#=pars#>)
-		{
-<#
-var any = false;
-foreach (var p in m.GetParameters())
-{
-	if (!p.ParameterType.IsValueType && !p.ParameterType.IsGenericParameter)
-	{
-		any = true;
-#>
-			if (<#=p.Name#> == null)
-				throw new ArgumentNullException("<#=p.Name#>");
-<#
-	}
-}
-#>
-<#
-if (any)
-{
-#>
-
-<#
-}
-#>
-#if CRIPPLED_REFLECTION
-			return <#=cast#><#=provider#>.<#=factory#>(<#=infoofexpr#><#=rem#>);
-#else
-			return <#=cast#><#=provider#>.<#=factory#>(<#=expr#><#=rem#>);
-#endif
-		}
-
-<#
-}
-#>
-	}
-}

+ 5 - 1
Ix.NET/Source/System.Interactive.Async.Providers/Properties/AssemblyInfo.cs

@@ -1,4 +1,8 @@
-using System;
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
 using System.Resources;
 using System.Runtime.InteropServices;
 

+ 0 - 112
Ix.NET/Source/System.Interactive.Async.Providers/Reflection.cs

@@ -1,112 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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. 
-#if CRIPPLED_REFLECTION
-using System.Linq;
-using System.Reflection;
-
-namespace System.Reflection
-{
-    [Flags]
-    internal enum BindingFlags
-    {
-        Instance = 4,
-        Static = 8,
-        Public = 16,
-        NonPublic = 32,
-    }
-}
-
-namespace System
-{
-    internal static class TypeExtensions
-    {
-        public static bool IsNestedPrivate(this Type t)
-        {
-            return t.GetTypeInfo().IsNestedPrivate;
-        }
-
-        public static bool IsInterface(this Type t)
-        {
-            return t.GetTypeInfo().IsInterface;
-        }
-
-        public static bool IsGenericType(this Type t)
-        {
-            return t.GetTypeInfo().IsGenericType;
-        }
-
-        public static Type GetBaseType(this Type t)
-        {
-            return t.GetTypeInfo().BaseType;
-        }
-
-        public static Type[] GetGenericArguments(this Type t)
-        {
-            // TODO: check what's the right way to support this
-            return t.GetTypeInfo().GenericTypeParameters.ToArray();
-        }
-
-        public static Type[] GetInterfaces(this Type t)
-        {
-            return t.GetTypeInfo().ImplementedInterfaces.ToArray();
-        }
-
-        public static bool IsAssignableFrom(this Type t1, Type t2)
-        {
-            return t1.GetTypeInfo().IsAssignableFrom(t2.GetTypeInfo());
-        }
-
-        public static MethodInfo[] GetMethods(this Type t, BindingFlags flags)
-        {
-            return t.GetTypeInfo().DeclaredMethods.Where(m => IsVisible(m, flags)).ToArray();
-        }
-
-        private static bool IsVisible(MethodInfo method, BindingFlags flags)
-        {
-            if ((flags & BindingFlags.Public) != 0 != method.IsPublic)
-            {
-                return false;
-            }
-
-            if ((flags & BindingFlags.NonPublic) == 0 && !method.IsPublic)
-            {
-                return false;
-            }
-
-            if ((flags & BindingFlags.Static) != 0 != method.IsStatic)
-            {
-                return false;
-            }
-
-            return true;
-        }
-    }
-}
-#else
-namespace System
-{
-    internal static class TypeExtensions
-    {
-        public static bool IsNestedPrivate(this Type t)
-        {
-            return t.IsNestedPrivate;
-        }
-
-        public static bool IsInterface(this Type t)
-        {
-            return t.IsInterface;
-        }
-
-        public static bool IsGenericType(this Type t)
-        {
-            return t.IsGenericType;
-        }
-
-        public static Type GetBaseType(this Type t)
-        {
-            return t.BaseType;
-        }
-    }
-}
-#endif

+ 4 - 10
Ix.NET/Source/System.Interactive.Async.Providers/System.Interactive.Async.Providers.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <Description>Interactive Extensions Async Providers Library used to build query providers and express queries over async enumerable sequences.</Description>
     <AssemblyTitle>Interactive Extensions - Async Providers Library</AssemblyTitle>
-    <TargetFrameworks>net45;netstandard1.0;netstandard2.0</TargetFrameworks>
+    <TargetFrameworks>net45;net46;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
     <PackageTags>Ix;Interactive;Extensions;Enumerable;Asynchronous</PackageTags>
   </PropertyGroup>
 
@@ -13,18 +13,12 @@
 
   <ItemGroup>
     <ProjectReference Include="..\System.Interactive.Async\System.Interactive.Async.csproj" />
-  </ItemGroup>
-
-  <ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.0'">
-    <PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
+    <ProjectReference Include="..\System.Linq.Async.Queryable\System.Linq.Async.Queryable.csproj" />
   </ItemGroup>
 
   <ItemGroup>
-    <None Update="AsyncQueryable.Generated.tt" Generator="TextTemplatingFileGenerator" LastGenOutput="AsyncQueryable.Generated.cs" />
-    <Compile Update="AsyncQueryable.Generated.cs" DesignTime="True" AutoGen="True" DependentUpon="AsyncQueryable.Generated.tt" />
+    <None Update="System\Linq\AsyncQueryableEx.Generated.tt" Generator="TextTemplatingFileGenerator" LastGenOutput="AsyncQueryableEx.Generated.cs" />
+    <Compile Update="System\Linq\AsyncQueryableEx.Generated.cs" DesignTime="True" AutoGen="True" DependentUpon="AsyncQueryableEx.Generated.tt" />
   </ItemGroup>
 
-  <ItemGroup>
-    <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
-  </ItemGroup>
 </Project>

+ 1146 - 0
Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.cs

@@ -0,0 +1,1146 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Collections.Generic;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace System.Linq
+{
+    public static partial class AsyncQueryableEx
+    {
+        private static MethodInfo s_Amb__TSource__2__0;
+        
+        private static MethodInfo Amb__TSource__2__0(Type TSource) =>
+            (s_Amb__TSource__2__0 ??
+            (s_Amb__TSource__2__0 = new Func<IAsyncQueryable<object>, IAsyncEnumerable<object>, IAsyncQueryable<object>>(Amb<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Amb<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
+        {
+            if (first == null)
+                throw new ArgumentNullException(nameof(first));
+            if (second == null)
+                throw new ArgumentNullException(nameof(second));
+
+            return first.Provider.CreateQuery<TSource>(Expression.Call(Amb__TSource__2__0(typeof(TSource)), first.Expression, GetSourceExpression(second)));
+        }
+
+        private static MethodInfo s_Buffer__TSource__2__0;
+        
+        private static MethodInfo Buffer__TSource__2__0(Type TSource) =>
+            (s_Buffer__TSource__2__0 ??
+            (s_Buffer__TSource__2__0 = new Func<IAsyncQueryable<object>, int, IAsyncQueryable<IList<object>>>(Buffer<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<IList<TSource>> Buffer<TSource>(this IAsyncQueryable<TSource> source, int count)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(Buffer__TSource__2__0(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
+        }
+
+        private static MethodInfo s_Buffer__TSource__3__0;
+        
+        private static MethodInfo Buffer__TSource__3__0(Type TSource) =>
+            (s_Buffer__TSource__3__0 ??
+            (s_Buffer__TSource__3__0 = new Func<IAsyncQueryable<object>, int, int, IAsyncQueryable<IList<object>>>(Buffer<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<IList<TSource>> Buffer<TSource>(this IAsyncQueryable<TSource> source, int count, int skip)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(Buffer__TSource__3__0(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)), Expression.Constant(skip, typeof(int))));
+        }
+
+        private static MethodInfo s_Catch__TSource__2__0;
+        
+        private static MethodInfo Catch__TSource__2__0(Type TSource) =>
+            (s_Catch__TSource__2__0 ??
+            (s_Catch__TSource__2__0 = new Func<IAsyncQueryable<object>, IAsyncEnumerable<object>, IAsyncQueryable<object>>(Catch<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Catch<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
+        {
+            if (first == null)
+                throw new ArgumentNullException(nameof(first));
+            if (second == null)
+                throw new ArgumentNullException(nameof(second));
+
+            return first.Provider.CreateQuery<TSource>(Expression.Call(Catch__TSource__2__0(typeof(TSource)), first.Expression, GetSourceExpression(second)));
+        }
+
+        private static MethodInfo s_Catch__TSource_TException__2__0;
+        
+        private static MethodInfo Catch__TSource_TException__2__0(Type TSource, Type TException) =>
+            (s_Catch__TSource_TException__2__0 ??
+            (s_Catch__TSource_TException__2__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<IAsyncEnumerable<object>>>>, IAsyncQueryable<object>>(Catch<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TException);
+
+        public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, CancellationToken, ValueTask<IAsyncEnumerable<TSource>>>> handler)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (handler == null)
+                throw new ArgumentNullException(nameof(handler));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Catch__TSource_TException__2__0(typeof(TSource), typeof(TException)), source.Expression, handler));
+        }
+
+        private static MethodInfo s_Catch__TSource_TException__2__1;
+        
+        private static MethodInfo Catch__TSource_TException__2__1(Type TSource, Type TException) =>
+            (s_Catch__TSource_TException__2__1 ??
+            (s_Catch__TSource_TException__2__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, IAsyncEnumerable<object>>>, IAsyncQueryable<object>>(Catch<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TException);
+
+        public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, IAsyncEnumerable<TSource>>> handler)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (handler == null)
+                throw new ArgumentNullException(nameof(handler));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Catch__TSource_TException__2__1(typeof(TSource), typeof(TException)), source.Expression, handler));
+        }
+
+        private static MethodInfo s_Catch__TSource_TException__2__2;
+        
+        private static MethodInfo Catch__TSource_TException__2__2(Type TSource, Type TException) =>
+            (s_Catch__TSource_TException__2__2 ??
+            (s_Catch__TSource_TException__2__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<IAsyncEnumerable<object>>>>, IAsyncQueryable<object>>(Catch<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TException);
+
+        public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, ValueTask<IAsyncEnumerable<TSource>>>> handler)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (handler == null)
+                throw new ArgumentNullException(nameof(handler));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Catch__TSource_TException__2__2(typeof(TSource), typeof(TException)), source.Expression, handler));
+        }
+
+        private static MethodInfo s_Concat__TSource__1__0;
+        
+        private static MethodInfo Concat__TSource__1__0(Type TSource) =>
+            (s_Concat__TSource__1__0 ??
+            (s_Concat__TSource__1__0 = new Func<IAsyncQueryable<IAsyncEnumerable<object>>, IAsyncQueryable<object>>(Concat<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Concat<TSource>(this IAsyncQueryable<IAsyncEnumerable<TSource>> sources)
+        {
+            if (sources == null)
+                throw new ArgumentNullException(nameof(sources));
+
+            return sources.Provider.CreateQuery<TSource>(Expression.Call(Concat__TSource__1__0(typeof(TSource)), sources.Expression));
+        }
+
+        private static MethodInfo s_Distinct__TSource_TKey__2__0;
+        
+        private static MethodInfo Distinct__TSource_TKey__2__0(Type TSource, Type TKey) =>
+            (s_Distinct__TSource_TKey__2__0 ??
+            (s_Distinct__TSource_TKey__2__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Distinct__TSource_TKey__2__0(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
+        }
+
+        private static MethodInfo s_Distinct__TSource_TKey__2__1;
+        
+        private static MethodInfo Distinct__TSource_TKey__2__1(Type TSource, Type TKey) =>
+            (s_Distinct__TSource_TKey__2__1 ??
+            (s_Distinct__TSource_TKey__2__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Distinct__TSource_TKey__2__1(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
+        }
+
+        private static MethodInfo s_Distinct__TSource_TKey__2__2;
+        
+        private static MethodInfo Distinct__TSource_TKey__2__2(Type TSource, Type TKey) =>
+            (s_Distinct__TSource_TKey__2__2 ??
+            (s_Distinct__TSource_TKey__2__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Distinct__TSource_TKey__2__2(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
+        }
+
+        private static MethodInfo s_Distinct__TSource_TKey__3__0;
+        
+        private static MethodInfo Distinct__TSource_TKey__3__0(Type TSource, Type TKey) =>
+            (s_Distinct__TSource_TKey__3__0 ??
+            (s_Distinct__TSource_TKey__3__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IEqualityComparer<object>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Distinct__TSource_TKey__3__0(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
+        }
+
+        private static MethodInfo s_Distinct__TSource_TKey__3__1;
+        
+        private static MethodInfo Distinct__TSource_TKey__3__1(Type TSource, Type TKey) =>
+            (s_Distinct__TSource_TKey__3__1 ??
+            (s_Distinct__TSource_TKey__3__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IEqualityComparer<object>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Distinct__TSource_TKey__3__1(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
+        }
+
+        private static MethodInfo s_Distinct__TSource_TKey__3__2;
+        
+        private static MethodInfo Distinct__TSource_TKey__3__2(Type TSource, Type TKey) =>
+            (s_Distinct__TSource_TKey__3__2 ??
+            (s_Distinct__TSource_TKey__3__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IEqualityComparer<object>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Distinct__TSource_TKey__3__2(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
+        }
+
+        private static MethodInfo s_DistinctUntilChanged__TSource__1__0;
+        
+        private static MethodInfo DistinctUntilChanged__TSource__1__0(Type TSource) =>
+            (s_DistinctUntilChanged__TSource__1__0 ??
+            (s_DistinctUntilChanged__TSource__1__0 = new Func<IAsyncQueryable<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(DistinctUntilChanged__TSource__1__0(typeof(TSource)), source.Expression));
+        }
+
+        private static MethodInfo s_DistinctUntilChanged__TSource__2__0;
+        
+        private static MethodInfo DistinctUntilChanged__TSource__2__0(Type TSource) =>
+            (s_DistinctUntilChanged__TSource__2__0 ??
+            (s_DistinctUntilChanged__TSource__2__0 = new Func<IAsyncQueryable<object>, IEqualityComparer<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource> comparer)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(DistinctUntilChanged__TSource__2__0(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
+        }
+
+        private static MethodInfo s_DistinctUntilChanged__TSource_TKey__2__0;
+        
+        private static MethodInfo DistinctUntilChanged__TSource_TKey__2__0(Type TSource, Type TKey) =>
+            (s_DistinctUntilChanged__TSource_TKey__2__0 ??
+            (s_DistinctUntilChanged__TSource_TKey__2__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(DistinctUntilChanged__TSource_TKey__2__0(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
+        }
+
+        private static MethodInfo s_DistinctUntilChanged__TSource_TKey__2__1;
+        
+        private static MethodInfo DistinctUntilChanged__TSource_TKey__2__1(Type TSource, Type TKey) =>
+            (s_DistinctUntilChanged__TSource_TKey__2__1 ??
+            (s_DistinctUntilChanged__TSource_TKey__2__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(DistinctUntilChanged__TSource_TKey__2__1(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
+        }
+
+        private static MethodInfo s_DistinctUntilChanged__TSource_TKey__2__2;
+        
+        private static MethodInfo DistinctUntilChanged__TSource_TKey__2__2(Type TSource, Type TKey) =>
+            (s_DistinctUntilChanged__TSource_TKey__2__2 ??
+            (s_DistinctUntilChanged__TSource_TKey__2__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(DistinctUntilChanged__TSource_TKey__2__2(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
+        }
+
+        private static MethodInfo s_DistinctUntilChanged__TSource_TKey__3__0;
+        
+        private static MethodInfo DistinctUntilChanged__TSource_TKey__3__0(Type TSource, Type TKey) =>
+            (s_DistinctUntilChanged__TSource_TKey__3__0 ??
+            (s_DistinctUntilChanged__TSource_TKey__3__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IEqualityComparer<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(DistinctUntilChanged__TSource_TKey__3__0(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
+        }
+
+        private static MethodInfo s_DistinctUntilChanged__TSource_TKey__3__1;
+        
+        private static MethodInfo DistinctUntilChanged__TSource_TKey__3__1(Type TSource, Type TKey) =>
+            (s_DistinctUntilChanged__TSource_TKey__3__1 ??
+            (s_DistinctUntilChanged__TSource_TKey__3__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IEqualityComparer<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(DistinctUntilChanged__TSource_TKey__3__1(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
+        }
+
+        private static MethodInfo s_DistinctUntilChanged__TSource_TKey__3__2;
+        
+        private static MethodInfo DistinctUntilChanged__TSource_TKey__3__2(Type TSource, Type TKey) =>
+            (s_DistinctUntilChanged__TSource_TKey__3__2 ??
+            (s_DistinctUntilChanged__TSource_TKey__3__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IEqualityComparer<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(DistinctUntilChanged__TSource_TKey__3__2(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
+        }
+
+        private static MethodInfo s_Do__TSource__2__0;
+        
+        private static MethodInfo Do__TSource__2__0(Type TSource) =>
+            (s_Do__TSource__2__0 ??
+            (s_Do__TSource__2__0 = new Func<IAsyncQueryable<object>, Expression<Action<object>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__2__0(typeof(TSource)), source.Expression, onNext));
+        }
+
+        private static MethodInfo s_Do__TSource__2__1;
+        
+        private static MethodInfo Do__TSource__2__1(Type TSource) =>
+            (s_Do__TSource__2__1 ??
+            (s_Do__TSource__2__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, Task>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__2__1(typeof(TSource)), source.Expression, onNext));
+        }
+
+        private static MethodInfo s_Do__TSource__2__2;
+        
+        private static MethodInfo Do__TSource__2__2(Type TSource) =>
+            (s_Do__TSource__2__2 ??
+            (s_Do__TSource__2__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, Task>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__2__2(typeof(TSource)), source.Expression, onNext));
+        }
+
+        private static MethodInfo s_Do__TSource__2__3;
+        
+        private static MethodInfo Do__TSource__2__3(Type TSource) =>
+            (s_Do__TSource__2__3 ??
+            (s_Do__TSource__2__3 = new Func<IAsyncQueryable<object>, IObserver<object>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, IObserver<TSource> observer)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (observer == null)
+                throw new ArgumentNullException(nameof(observer));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__2__3(typeof(TSource)), source.Expression, Expression.Constant(observer, typeof(IObserver<TSource>))));
+        }
+
+        private static MethodInfo s_Do__TSource__3__0;
+        
+        private static MethodInfo Do__TSource__3__0(Type TSource) =>
+            (s_Do__TSource__3__0 ??
+            (s_Do__TSource__3__0 = new Func<IAsyncQueryable<object>, Expression<Action<object>>, Action, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Action onCompleted)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onCompleted == null)
+                throw new ArgumentNullException(nameof(onCompleted));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__3__0(typeof(TSource)), source.Expression, onNext, Expression.Constant(onCompleted, typeof(Action))));
+        }
+
+        private static MethodInfo s_Do__TSource__3__1;
+        
+        private static MethodInfo Do__TSource__3__1(Type TSource) =>
+            (s_Do__TSource__3__1 ??
+            (s_Do__TSource__3__1 = new Func<IAsyncQueryable<object>, Expression<Action<object>>, Expression<Action<Exception>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onError == null)
+                throw new ArgumentNullException(nameof(onError));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__3__1(typeof(TSource)), source.Expression, onNext, onError));
+        }
+
+        private static MethodInfo s_Do__TSource__3__2;
+        
+        private static MethodInfo Do__TSource__3__2(Type TSource) =>
+            (s_Do__TSource__3__2 ??
+            (s_Do__TSource__3__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, Task>>, Expression<Func<CancellationToken, Task>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext, Expression<Func<CancellationToken, Task>> onCompleted)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onCompleted == null)
+                throw new ArgumentNullException(nameof(onCompleted));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__3__2(typeof(TSource)), source.Expression, onNext, onCompleted));
+        }
+
+        private static MethodInfo s_Do__TSource__3__3;
+        
+        private static MethodInfo Do__TSource__3__3(Type TSource) =>
+            (s_Do__TSource__3__3 ??
+            (s_Do__TSource__3__3 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, Task>>, Expression<Func<Exception, CancellationToken, Task>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext, Expression<Func<Exception, CancellationToken, Task>> onError)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onError == null)
+                throw new ArgumentNullException(nameof(onError));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__3__3(typeof(TSource)), source.Expression, onNext, onError));
+        }
+
+        private static MethodInfo s_Do__TSource__3__4;
+        
+        private static MethodInfo Do__TSource__3__4(Type TSource) =>
+            (s_Do__TSource__3__4 ??
+            (s_Do__TSource__3__4 = new Func<IAsyncQueryable<object>, Expression<Func<object, Task>>, Expression<Func<Exception, Task>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext, Expression<Func<Exception, Task>> onError)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onError == null)
+                throw new ArgumentNullException(nameof(onError));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__3__4(typeof(TSource)), source.Expression, onNext, onError));
+        }
+
+        private static MethodInfo s_Do__TSource__3__5;
+        
+        private static MethodInfo Do__TSource__3__5(Type TSource) =>
+            (s_Do__TSource__3__5 ??
+            (s_Do__TSource__3__5 = new Func<IAsyncQueryable<object>, Expression<Func<object, Task>>, Expression<Func<Task>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext, Expression<Func<Task>> onCompleted)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onCompleted == null)
+                throw new ArgumentNullException(nameof(onCompleted));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__3__5(typeof(TSource)), source.Expression, onNext, onCompleted));
+        }
+
+        private static MethodInfo s_Do__TSource__4__0;
+        
+        private static MethodInfo Do__TSource__4__0(Type TSource) =>
+            (s_Do__TSource__4__0 ??
+            (s_Do__TSource__4__0 = new Func<IAsyncQueryable<object>, Expression<Action<object>>, Expression<Action<Exception>>, Action, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError, Action onCompleted)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onError == null)
+                throw new ArgumentNullException(nameof(onError));
+            if (onCompleted == null)
+                throw new ArgumentNullException(nameof(onCompleted));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__4__0(typeof(TSource)), source.Expression, onNext, onError, Expression.Constant(onCompleted, typeof(Action))));
+        }
+
+        private static MethodInfo s_Do__TSource__4__1;
+        
+        private static MethodInfo Do__TSource__4__1(Type TSource) =>
+            (s_Do__TSource__4__1 ??
+            (s_Do__TSource__4__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, Task>>, Expression<Func<Exception, CancellationToken, Task>>, Expression<Func<CancellationToken, Task>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext, Expression<Func<Exception, CancellationToken, Task>> onError, Expression<Func<CancellationToken, Task>> onCompleted)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onError == null)
+                throw new ArgumentNullException(nameof(onError));
+            if (onCompleted == null)
+                throw new ArgumentNullException(nameof(onCompleted));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__4__1(typeof(TSource)), source.Expression, onNext, onError, onCompleted));
+        }
+
+        private static MethodInfo s_Do__TSource__4__2;
+        
+        private static MethodInfo Do__TSource__4__2(Type TSource) =>
+            (s_Do__TSource__4__2 ??
+            (s_Do__TSource__4__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, Task>>, Expression<Func<Exception, Task>>, Expression<Func<Task>>, IAsyncQueryable<object>>(Do<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext, Expression<Func<Exception, Task>> onError, Expression<Func<Task>> onCompleted)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNext == null)
+                throw new ArgumentNullException(nameof(onNext));
+            if (onError == null)
+                throw new ArgumentNullException(nameof(onError));
+            if (onCompleted == null)
+                throw new ArgumentNullException(nameof(onCompleted));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Do__TSource__4__2(typeof(TSource)), source.Expression, onNext, onError, onCompleted));
+        }
+
+        private static MethodInfo s_Expand__TSource__2__0;
+        
+        private static MethodInfo Expand__TSource__2__0(Type TSource) =>
+            (s_Expand__TSource__2__0 ??
+            (s_Expand__TSource__2__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<IAsyncEnumerable<object>>>>, IAsyncQueryable<object>>(Expand<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<IAsyncEnumerable<TSource>>>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Expand__TSource__2__0(typeof(TSource)), source.Expression, selector));
+        }
+
+        private static MethodInfo s_Expand__TSource__2__1;
+        
+        private static MethodInfo Expand__TSource__2__1(Type TSource) =>
+            (s_Expand__TSource__2__1 ??
+            (s_Expand__TSource__2__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, IAsyncEnumerable<object>>>, IAsyncQueryable<object>>(Expand<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TSource>>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Expand__TSource__2__1(typeof(TSource)), source.Expression, selector));
+        }
+
+        private static MethodInfo s_Expand__TSource__2__2;
+        
+        private static MethodInfo Expand__TSource__2__2(Type TSource) =>
+            (s_Expand__TSource__2__2 ??
+            (s_Expand__TSource__2__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<IAsyncEnumerable<object>>>>, IAsyncQueryable<object>>(Expand<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<IAsyncEnumerable<TSource>>>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Expand__TSource__2__2(typeof(TSource)), source.Expression, selector));
+        }
+
+        private static MethodInfo s_Finally__TSource__2__0;
+        
+        private static MethodInfo Finally__TSource__2__0(Type TSource) =>
+            (s_Finally__TSource__2__0 ??
+            (s_Finally__TSource__2__0 = new Func<IAsyncQueryable<object>, Action, IAsyncQueryable<object>>(Finally<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Finally<TSource>(this IAsyncQueryable<TSource> source, Action finallyAction)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (finallyAction == null)
+                throw new ArgumentNullException(nameof(finallyAction));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Finally__TSource__2__0(typeof(TSource)), source.Expression, Expression.Constant(finallyAction, typeof(Action))));
+        }
+
+        private static MethodInfo s_Finally__TSource__2__1;
+        
+        private static MethodInfo Finally__TSource__2__1(Type TSource) =>
+            (s_Finally__TSource__2__1 ??
+            (s_Finally__TSource__2__1 = new Func<IAsyncQueryable<object>, Expression<Func<Task>>, IAsyncQueryable<object>>(Finally<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Finally<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<Task>> finallyAction)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (finallyAction == null)
+                throw new ArgumentNullException(nameof(finallyAction));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Finally__TSource__2__1(typeof(TSource)), source.Expression, finallyAction));
+        }
+
+        private static MethodInfo s_IgnoreElements__TSource__1__0;
+        
+        private static MethodInfo IgnoreElements__TSource__1__0(Type TSource) =>
+            (s_IgnoreElements__TSource__1__0 ??
+            (s_IgnoreElements__TSource__1__0 = new Func<IAsyncQueryable<object>, IAsyncQueryable<object>>(IgnoreElements<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> IgnoreElements<TSource>(this IAsyncQueryable<TSource> source)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(IgnoreElements__TSource__1__0(typeof(TSource)), source.Expression));
+        }
+
+        private static MethodInfo s_IsEmptyAsync__TSource__2__0;
+        
+        private static MethodInfo IsEmptyAsync__TSource__2__0(Type TSource) =>
+            (s_IsEmptyAsync__TSource__2__0 ??
+            (s_IsEmptyAsync__TSource__2__0 = new Func<IAsyncQueryable<object>, CancellationToken, ValueTask<bool>>(IsEmptyAsync<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static ValueTask<bool> IsEmptyAsync<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.ExecuteAsync<bool>(Expression.Call(IsEmptyAsync__TSource__2__0(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MaxAsync__TSource__3__0;
+        
+        private static MethodInfo MaxAsync__TSource__3__0(Type TSource) =>
+            (s_MaxAsync__TSource__3__0 ??
+            (s_MaxAsync__TSource__3__0 = new Func<IAsyncQueryable<object>, IComparer<object>, CancellationToken, ValueTask<object>>(MaxAsync<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static ValueTask<TSource> MaxAsync<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.ExecuteAsync<TSource>(Expression.Call(MaxAsync__TSource__3__0(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MaxByAsync__TSource_TKey__3__0;
+        
+        private static MethodInfo MaxByAsync__TSource_TKey__3__0(Type TSource, Type TKey) =>
+            (s_MaxByAsync__TSource_TKey__3__0 ??
+            (s_MaxByAsync__TSource_TKey__3__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MaxByAsync__TSource_TKey__3__0(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MaxByAsync__TSource_TKey__3__1;
+        
+        private static MethodInfo MaxByAsync__TSource_TKey__3__1(Type TSource, Type TKey) =>
+            (s_MaxByAsync__TSource_TKey__3__1 ??
+            (s_MaxByAsync__TSource_TKey__3__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MaxByAsync__TSource_TKey__3__1(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MaxByAsync__TSource_TKey__3__2;
+        
+        private static MethodInfo MaxByAsync__TSource_TKey__3__2(Type TSource, Type TKey) =>
+            (s_MaxByAsync__TSource_TKey__3__2 ??
+            (s_MaxByAsync__TSource_TKey__3__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MaxByAsync__TSource_TKey__3__2(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MaxByAsync__TSource_TKey__4__0;
+        
+        private static MethodInfo MaxByAsync__TSource_TKey__4__0(Type TSource, Type TKey) =>
+            (s_MaxByAsync__TSource_TKey__4__0 ??
+            (s_MaxByAsync__TSource_TKey__4__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MaxByAsync__TSource_TKey__4__0(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MaxByAsync__TSource_TKey__4__1;
+        
+        private static MethodInfo MaxByAsync__TSource_TKey__4__1(Type TSource, Type TKey) =>
+            (s_MaxByAsync__TSource_TKey__4__1 ??
+            (s_MaxByAsync__TSource_TKey__4__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MaxByAsync__TSource_TKey__4__1(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MaxByAsync__TSource_TKey__4__2;
+        
+        private static MethodInfo MaxByAsync__TSource_TKey__4__2(Type TSource, Type TKey) =>
+            (s_MaxByAsync__TSource_TKey__4__2 ??
+            (s_MaxByAsync__TSource_TKey__4__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MaxByAsync__TSource_TKey__4__2(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_Merge__TSource__1__0;
+        
+        private static MethodInfo Merge__TSource__1__0(Type TSource) =>
+            (s_Merge__TSource__1__0 ??
+            (s_Merge__TSource__1__0 = new Func<IAsyncQueryable<IAsyncEnumerable<object>>, IAsyncQueryable<object>>(Merge<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Merge<TSource>(this IAsyncQueryable<IAsyncEnumerable<TSource>> sources)
+        {
+            if (sources == null)
+                throw new ArgumentNullException(nameof(sources));
+
+            return sources.Provider.CreateQuery<TSource>(Expression.Call(Merge__TSource__1__0(typeof(TSource)), sources.Expression));
+        }
+
+        private static MethodInfo s_MinAsync__TSource__3__0;
+        
+        private static MethodInfo MinAsync__TSource__3__0(Type TSource) =>
+            (s_MinAsync__TSource__3__0 ??
+            (s_MinAsync__TSource__3__0 = new Func<IAsyncQueryable<object>, IComparer<object>, CancellationToken, ValueTask<object>>(MinAsync<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static ValueTask<TSource> MinAsync<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.ExecuteAsync<TSource>(Expression.Call(MinAsync__TSource__3__0(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MinByAsync__TSource_TKey__3__0;
+        
+        private static MethodInfo MinByAsync__TSource_TKey__3__0(Type TSource, Type TKey) =>
+            (s_MinByAsync__TSource_TKey__3__0 ??
+            (s_MinByAsync__TSource_TKey__3__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MinByAsync__TSource_TKey__3__0(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MinByAsync__TSource_TKey__3__1;
+        
+        private static MethodInfo MinByAsync__TSource_TKey__3__1(Type TSource, Type TKey) =>
+            (s_MinByAsync__TSource_TKey__3__1 ??
+            (s_MinByAsync__TSource_TKey__3__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MinByAsync__TSource_TKey__3__1(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MinByAsync__TSource_TKey__3__2;
+        
+        private static MethodInfo MinByAsync__TSource_TKey__3__2(Type TSource, Type TKey) =>
+            (s_MinByAsync__TSource_TKey__3__2 ??
+            (s_MinByAsync__TSource_TKey__3__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MinByAsync__TSource_TKey__3__2(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MinByAsync__TSource_TKey__4__0;
+        
+        private static MethodInfo MinByAsync__TSource_TKey__4__0(Type TSource, Type TKey) =>
+            (s_MinByAsync__TSource_TKey__4__0 ??
+            (s_MinByAsync__TSource_TKey__4__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MinByAsync__TSource_TKey__4__0(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MinByAsync__TSource_TKey__4__1;
+        
+        private static MethodInfo MinByAsync__TSource_TKey__4__1(Type TSource, Type TKey) =>
+            (s_MinByAsync__TSource_TKey__4__1 ??
+            (s_MinByAsync__TSource_TKey__4__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MinByAsync__TSource_TKey__4__1(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_MinByAsync__TSource_TKey__4__2;
+        
+        private static MethodInfo MinByAsync__TSource_TKey__4__2(Type TSource, Type TKey) =>
+            (s_MinByAsync__TSource_TKey__4__2 ??
+            (s_MinByAsync__TSource_TKey__4__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
+
+        public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (keySelector == null)
+                throw new ArgumentNullException(nameof(keySelector));
+
+            return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(MinByAsync__TSource_TKey__4__2(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
+        }
+
+        private static MethodInfo s_OnErrorResumeNext__TSource__2__0;
+        
+        private static MethodInfo OnErrorResumeNext__TSource__2__0(Type TSource) =>
+            (s_OnErrorResumeNext__TSource__2__0 ??
+            (s_OnErrorResumeNext__TSource__2__0 = new Func<IAsyncQueryable<object>, IAsyncEnumerable<object>, IAsyncQueryable<object>>(OnErrorResumeNext<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> OnErrorResumeNext<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
+        {
+            if (first == null)
+                throw new ArgumentNullException(nameof(first));
+            if (second == null)
+                throw new ArgumentNullException(nameof(second));
+
+            return first.Provider.CreateQuery<TSource>(Expression.Call(OnErrorResumeNext__TSource__2__0(typeof(TSource)), first.Expression, GetSourceExpression(second)));
+        }
+
+        private static MethodInfo s_Repeat__TSource__1__0;
+        
+        private static MethodInfo Repeat__TSource__1__0(Type TSource) =>
+            (s_Repeat__TSource__1__0 ??
+            (s_Repeat__TSource__1__0 = new Func<IAsyncQueryable<object>, IAsyncQueryable<object>>(Repeat<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Repeat__TSource__1__0(typeof(TSource)), source.Expression));
+        }
+
+        private static MethodInfo s_Repeat__TSource__2__0;
+        
+        private static MethodInfo Repeat__TSource__2__0(Type TSource) =>
+            (s_Repeat__TSource__2__0 ??
+            (s_Repeat__TSource__2__0 = new Func<IAsyncQueryable<object>, int, IAsyncQueryable<object>>(Repeat<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source, int count)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Repeat__TSource__2__0(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
+        }
+
+        private static MethodInfo s_Retry__TSource__1__0;
+        
+        private static MethodInfo Retry__TSource__1__0(Type TSource) =>
+            (s_Retry__TSource__1__0 ??
+            (s_Retry__TSource__1__0 = new Func<IAsyncQueryable<object>, IAsyncQueryable<object>>(Retry<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Retry<TSource>(this IAsyncQueryable<TSource> source)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Retry__TSource__1__0(typeof(TSource)), source.Expression));
+        }
+
+        private static MethodInfo s_Retry__TSource__2__0;
+        
+        private static MethodInfo Retry__TSource__2__0(Type TSource) =>
+            (s_Retry__TSource__2__0 ??
+            (s_Retry__TSource__2__0 = new Func<IAsyncQueryable<object>, int, IAsyncQueryable<object>>(Retry<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Retry<TSource>(this IAsyncQueryable<TSource> source, int retryCount)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Retry__TSource__2__0(typeof(TSource)), source.Expression, Expression.Constant(retryCount, typeof(int))));
+        }
+
+        private static MethodInfo s_Scan__TSource__2__0;
+        
+        private static MethodInfo Scan__TSource__2__0(Type TSource) =>
+            (s_Scan__TSource__2__0 ??
+            (s_Scan__TSource__2__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, object, CancellationToken, ValueTask<object>>>, IAsyncQueryable<object>>(Scan<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, CancellationToken, ValueTask<TSource>>> accumulator)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (accumulator == null)
+                throw new ArgumentNullException(nameof(accumulator));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Scan__TSource__2__0(typeof(TSource)), source.Expression, accumulator));
+        }
+
+        private static MethodInfo s_Scan__TSource__2__1;
+        
+        private static MethodInfo Scan__TSource__2__1(Type TSource) =>
+            (s_Scan__TSource__2__1 ??
+            (s_Scan__TSource__2__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object, object>>, IAsyncQueryable<object>>(Scan<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (accumulator == null)
+                throw new ArgumentNullException(nameof(accumulator));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Scan__TSource__2__1(typeof(TSource)), source.Expression, accumulator));
+        }
+
+        private static MethodInfo s_Scan__TSource__2__2;
+        
+        private static MethodInfo Scan__TSource__2__2(Type TSource) =>
+            (s_Scan__TSource__2__2 ??
+            (s_Scan__TSource__2__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, object, ValueTask<object>>>, IAsyncQueryable<object>>(Scan<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, ValueTask<TSource>>> accumulator)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (accumulator == null)
+                throw new ArgumentNullException(nameof(accumulator));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Scan__TSource__2__2(typeof(TSource)), source.Expression, accumulator));
+        }
+
+        private static MethodInfo s_Scan__TSource_TAccumulate__3__0;
+        
+        private static MethodInfo Scan__TSource_TAccumulate__3__0(Type TSource, Type TAccumulate) =>
+            (s_Scan__TSource_TAccumulate__3__0 ??
+            (s_Scan__TSource_TAccumulate__3__0 = new Func<IAsyncQueryable<object>, object, Expression<Func<object, object, CancellationToken, ValueTask<object>>>, IAsyncQueryable<object>>(Scan<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TAccumulate);
+
+        public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, CancellationToken, ValueTask<TAccumulate>>> accumulator)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (accumulator == null)
+                throw new ArgumentNullException(nameof(accumulator));
+
+            return source.Provider.CreateQuery<TAccumulate>(Expression.Call(Scan__TSource_TAccumulate__3__0(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
+        }
+
+        private static MethodInfo s_Scan__TSource_TAccumulate__3__1;
+        
+        private static MethodInfo Scan__TSource_TAccumulate__3__1(Type TSource, Type TAccumulate) =>
+            (s_Scan__TSource_TAccumulate__3__1 ??
+            (s_Scan__TSource_TAccumulate__3__1 = new Func<IAsyncQueryable<object>, object, Expression<Func<object, object, object>>, IAsyncQueryable<object>>(Scan<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TAccumulate);
+
+        public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (accumulator == null)
+                throw new ArgumentNullException(nameof(accumulator));
+
+            return source.Provider.CreateQuery<TAccumulate>(Expression.Call(Scan__TSource_TAccumulate__3__1(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
+        }
+
+        private static MethodInfo s_Scan__TSource_TAccumulate__3__2;
+        
+        private static MethodInfo Scan__TSource_TAccumulate__3__2(Type TSource, Type TAccumulate) =>
+            (s_Scan__TSource_TAccumulate__3__2 ??
+            (s_Scan__TSource_TAccumulate__3__2 = new Func<IAsyncQueryable<object>, object, Expression<Func<object, object, ValueTask<object>>>, IAsyncQueryable<object>>(Scan<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TAccumulate);
+
+        public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, ValueTask<TAccumulate>>> accumulator)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (accumulator == null)
+                throw new ArgumentNullException(nameof(accumulator));
+
+            return source.Provider.CreateQuery<TAccumulate>(Expression.Call(Scan__TSource_TAccumulate__3__2(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
+        }
+
+        private static MethodInfo s_SelectMany__TSource_TOther__2__0;
+        
+        private static MethodInfo SelectMany__TSource_TOther__2__0(Type TSource, Type TOther) =>
+            (s_SelectMany__TSource_TOther__2__0 ??
+            (s_SelectMany__TSource_TOther__2__0 = new Func<IAsyncQueryable<object>, IAsyncEnumerable<object>, IAsyncQueryable<object>>(SelectMany<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TOther);
+
+        public static IAsyncQueryable<TOther> SelectMany<TSource, TOther>(this IAsyncQueryable<TSource> source, IAsyncEnumerable<TOther> other)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (other == null)
+                throw new ArgumentNullException(nameof(other));
+
+            return source.Provider.CreateQuery<TOther>(Expression.Call(SelectMany__TSource_TOther__2__0(typeof(TSource), typeof(TOther)), source.Expression, GetSourceExpression(other)));
+        }
+
+        private static MethodInfo s_StartWith__TSource__2__0;
+        
+        private static MethodInfo StartWith__TSource__2__0(Type TSource) =>
+            (s_StartWith__TSource__2__0 ??
+            (s_StartWith__TSource__2__0 = new Func<IAsyncQueryable<object>, object[], IAsyncQueryable<object>>(StartWith<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> StartWith<TSource>(this IAsyncQueryable<TSource> source, params TSource[] values)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (values == null)
+                throw new ArgumentNullException(nameof(values));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(StartWith__TSource__2__0(typeof(TSource)), source.Expression, Expression.Constant(values, typeof(TSource[]))));
+        }
+
+        private static MethodInfo s_Timeout__TSource__2__0;
+        
+        private static MethodInfo Timeout__TSource__2__0(Type TSource) =>
+            (s_Timeout__TSource__2__0 ??
+            (s_Timeout__TSource__2__0 = new Func<IAsyncQueryable<object>, TimeSpan, IAsyncQueryable<object>>(Timeout<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
+
+        public static IAsyncQueryable<TSource> Timeout<TSource>(this IAsyncQueryable<TSource> source, TimeSpan timeout)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return source.Provider.CreateQuery<TSource>(Expression.Call(Timeout__TSource__2__0(typeof(TSource)), source.Expression, Expression.Constant(timeout, typeof(TimeSpan))));
+        }
+
+    }
+}

+ 16 - 0
Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.tt

@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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. 
+
+<#@ template debug="false" hostspecific="false" language="C#" #>
+<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net46\System.Threading.Tasks.Extensions.dll" #>
+<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net46\System.Linq.Async.dll" #>
+<#@ assembly name="$(ProjectDir)\..\System.Interactive.Async\bin\$(Configuration)\net46\System.Interactive.Async.dll" #>
+<#@ output extension=".cs" #>
+<#
+var asyncEnumerableType = typeof(AsyncEnumerableEx);
+var className = "AsyncQueryableEx";
+var nullableParameterNames = new[] { "comparer" };
+var exclude = new string[0];
+#>
+<#@ include file="$(SolutionDir)\AsyncQueryableGenerator.t4" #>

+ 26 - 0
Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.cs

@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Collections.Generic;
+using System.Linq.Expressions;
+
+namespace System.Linq
+{
+    /// <summary>
+    /// Provides a set of extension methods for asynchronous enumerable sequences represented using expression trees.
+    /// </summary>
+    [LocalQueryMethodImplementationType(typeof(AsyncEnumerableEx))]
+    public static partial class AsyncQueryableEx
+    {
+        private static Expression GetSourceExpression<TSource>(IAsyncEnumerable<TSource> source)
+        {
+            if (source is IAsyncQueryable<TSource> queryable)
+            {
+                return queryable.Expression;
+            }
+
+            return Expression.Constant(source, typeof(IAsyncEnumerable<TSource>));
+        }
+    }
+}

+ 0 - 639
Ix.NET/Source/System.Interactive.Async.Tests/AppendPrependTests.cs

@@ -1,639 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace Tests
-{
-    public partial class AsyncTests
-    {
-
-        [Fact]
-        public void AppendPrepend_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Append(null, 42));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Prepend(null, 42));
-        }
-
-        [Fact]
-        public void Append1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Append(4);
-
-            var e = res.GetEnumerator();
-
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task Append2()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Append(4);
-
-            var a = new[] { 1, 2, 3, 4 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task Append3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.Append(4);
-            var a = new List<int>
-            {
-                1,
-                2,
-                3,
-                4
-            };
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task Append4()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Append(4);
-            Assert.Equal(4, await res.Count());
-        }
-
-        [Fact]
-        public async Task Append5()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Append(4);
-
-            var a = new[] { 1, 2, 3, 4 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task Append6()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Append(4);
-            Assert.Equal(4, await res.Count());
-        }
-
-        [Fact]
-        public async Task Append7()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-            var res = xs.Append(4);
-            var a = new List<int>
-            {
-                1,
-                2,
-                3,
-                4
-            };
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-
-        [Fact]
-        public void AppendN1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Append(4)
-                        .Append(5)
-                        .Append(6);
-
-            var e = res.GetEnumerator();
-
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task AppendN2()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Append(4)
-                        .Append(5)
-                        .Append(6);
-
-            var a = new[] { 1, 2, 3, 4, 5, 6 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task AppendN3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.Append(4)
-                        .Append(5)
-                        .Append(6);
-
-            var a = new List<int>
-            {
-                1,
-                2,
-                3,
-                4,
-                5,
-                6
-            };
-
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-
-        [Fact]
-        public async Task AppendN5()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Append(4)
-                        .Append(5)
-                        .Append(6);
-
-            var a = new[] { 1, 2, 3, 4, 5, 6 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task AppendN6()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-            var res = xs.Append(4)
-                        .Append(5)
-                        .Append(6);
-
-            var a = new List<int>
-            {
-                1,
-                2,
-                3,
-                4,
-                5,
-                6
-            };
-
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task AppendN7()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Append(4)
-                        .Append(5)
-                        .Append(6);
-            Assert.Equal(6, await res.Count());
-        }
-
-        [Fact]
-        public async Task AppenN4()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Append(4)
-                        .Append(5)
-                        .Append(6);
-            Assert.Equal(6, await res.Count());
-        }
-
-        [Fact]
-        public void Prepend1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4);
-
-            var e = res.GetEnumerator();
-
-            HasNext(e, 4);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task Prepend2()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4);
-
-            var a = new[] { 4, 1, 2, 3 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task Prepend3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.Prepend(4);
-            var a = new List<int>
-            {
-                4,
-                1,
-                2,
-                3
-            };
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-
-        [Fact]
-        public async Task Prepend4()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4);
-            Assert.Equal(4, await res.Count());
-        }
-
-
-        [Fact]
-        public async Task Prepend5()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Prepend(4);
-
-            var a = new[] { 4, 1, 2, 3 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task Prepend6()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-            var res = xs.Prepend(4);
-            var a = new List<int>
-            {
-                4,
-                1,
-                2,
-                3
-            };
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-
-        [Fact]
-        public async Task Prepend7()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Prepend(4);
-            Assert.Equal(4, await res.Count());
-        }
-
-
-        [Fact]
-        public async Task Prepend8()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Prepend(4);
-
-            await SequenceIdentity(res);
-        }
-
-        [Fact]
-        public void PrependN1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4)
-                        .Prepend(5)
-                        .Prepend(6);
-
-            var e = res.GetEnumerator();
-
-            HasNext(e, 6);
-            HasNext(e, 5);
-            HasNext(e, 4);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task PrependN2()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4)
-                        .Prepend(5)
-                        .Prepend(6);
-
-            var a = new[] { 6, 5, 4, 1, 2, 3 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task PrependN3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.Prepend(4)
-                        .Prepend(5)
-                        .Prepend(6);
-
-            var a = new List<int>
-            {
-                6,
-                5,
-                4,
-                1,
-                2,
-                3
-            };
-
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task PrependN4()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4)
-                        .Prepend(5)
-                        .Prepend(6);
-            Assert.Equal(6, await res.Count());
-        }
-
-        [Fact]
-        public async Task PrependN5()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Prepend(4)
-                        .Prepend(5)
-                        .Prepend(6);
-
-            var a = new[] { 6, 5, 4, 1, 2, 3 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task PrependN6()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-            var res = xs.Prepend(4)
-                        .Prepend(5)
-                        .Prepend(6);
-
-            var a = new List<int>
-            {
-                6,
-                5,
-                4,
-                1,
-                2,
-                3
-            };
-
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task PrependN7()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Prepend(4)
-                        .Prepend(5)
-                        .Prepend(6);
-            Assert.Equal(6, await res.Count());
-        }
-
-
-        [Fact]
-        public void AppendPrepend1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4)
-                        .Append(5)
-                        .Append(6)
-                        .Prepend(7)
-                        .Append(8)
-                        .Prepend(9)
-                        .Prepend(10);
-
-            var e = res.GetEnumerator();
-
-
-            HasNext(e, 10);
-            HasNext(e, 9);
-            HasNext(e, 7);
-            HasNext(e, 4);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            HasNext(e, 8);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task AppendPrepend2()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4)
-                        .Append(5)
-                        .Append(6)
-                        .Prepend(7)
-                        .Append(8)
-                        .Prepend(9)
-                        .Prepend(10);
-
-            var a = new[] { 10, 9, 7, 4, 1, 2, 3, 5, 6, 8 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task AppendPrepend3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.Prepend(4)
-                        .Append(5)
-                        .Append(6)
-                        .Prepend(7)
-                        .Append(8)
-                        .Prepend(9)
-                        .Prepend(10);
-
-            var a = new List<int> { 10, 9, 7, 4, 1, 2, 3, 5, 6, 8 };
-
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task AppendPrepend4()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Prepend(4)
-                        .Append(5)
-                        .Append(6)
-                        .Prepend(7)
-                        .Append(8)
-                        .Prepend(9)
-                        .Prepend(10);
-
-            Assert.Equal(10, await res.Count());
-        }
-
-
-        [Fact]
-        public async Task AppendPrepend5()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Prepend(4)
-                        .Append(5)
-                        .Append(6)
-                        .Prepend(7)
-                        .Append(8)
-                        .Prepend(9)
-                        .Prepend(10);
-
-            var a = new[] { 10, 9, 7, 4, 1, 2, 3, 5, 6, 8 };
-
-            var arr = await res.ToArray();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task AppendPrepend6()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Prepend(4)
-                        .Append(5)
-                        .Append(6)
-                        .Prepend(7)
-                        .Append(8)
-                        .Prepend(9)
-                        .Prepend(10);
-
-            var a = new List<int> { 10, 9, 7, 4, 1, 2, 3, 5, 6, 8 };
-
-            var arr = await res.ToList();
-            Assert.Equal(a, arr);
-        }
-
-        [Fact]
-        public async Task AppendPrepend7()
-        {
-            var xs = AsyncEnumerable.Range(1, 3)
-                                    .Where(i => true);
-
-            var res = xs.Prepend(4)
-                        .Append(5)
-                        .Append(6)
-                        .Prepend(7)
-                        .Append(8)
-                        .Prepend(9)
-                        .Prepend(10);
-
-            Assert.Equal(10, await res.Count());
-        }
-
-        [Fact]
-        public void AppendPrepend8()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Append(4)
-                        .Prepend(5);
-
-            var e = res.GetEnumerator();
-
-            HasNext(e, 5);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task AppendPrepend9()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Append(4)
-                        .Prepend(5);
-
-            await SequenceIdentity(res);
-        }
-
-    }
-}

+ 0 - 3392
Ix.NET/Source/System.Interactive.Async.Tests/AsyncQueryableTests.Generated.cs

@@ -1,3392 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Threading;
-using Xunit;
-
-namespace Tests
-{
-	
-	public class AsyncQueryableTests
-	{
-		[Fact]
-		public void Aggregate1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "accumulator");
-
-			var res = AsyncQueryable.Aggregate<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Aggregate2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int>(default(IAsyncQueryable<int>), 1, (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "accumulator");
-
-			var res = AsyncQueryable.Aggregate<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Aggregate3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, int>>), CancellationToken.None), ane => ane.ParamName == "accumulator");
-
-			var res = AsyncQueryable.Aggregate<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Aggregate4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int, int>(default(IAsyncQueryable<int>), 1, (int arg0, int arg1) => default(int), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(Expression<Func<int, int, int>>), (int arg0) => default(int)), ane => ane.ParamName == "accumulator");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(int), default(Expression<Func<int, int>>)), ane => ane.ParamName == "resultSelector");
-
-			var res = AsyncQueryable.Aggregate<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(int), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Aggregate5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int>(default(IAsyncQueryable<int>), 1, (int arg0, int arg1) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(Expression<Func<int, int, int>>), CancellationToken.None), ane => ane.ParamName == "accumulator");
-
-			var res = AsyncQueryable.Aggregate<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Aggregate6()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int, int>(default(IAsyncQueryable<int>), 1, (int arg0, int arg1) => default(int), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(Expression<Func<int, int, int>>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "accumulator");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Aggregate<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(int), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "resultSelector");
-
-			var res = AsyncQueryable.Aggregate<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(int), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void All1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.All<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.All<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.All<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void All2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.All<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.All<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.All<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Any1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Any<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Any<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Any2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Any<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Any<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Any<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Any3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Any<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Any<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Any4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Any<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Any<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Any<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Append1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Append<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Append<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Average1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<int?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new int?[] { default(int?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<long>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new long[] { default(long) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<long?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new long?[] { default(long?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<double>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new double[] { default(double) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average6()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<double?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new double?[] { default(double?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average7()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<float>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new float[] { default(float) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average8()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<float?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new float?[] { default(float?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average9()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new decimal[] { default(decimal) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average10()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new decimal?[] { default(decimal?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average11()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<int>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<int>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average12()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average13()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(long)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(long));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average14()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<long>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<long>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average15()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(double)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(double));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average16()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<double>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<double>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average17()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(float)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(float));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average18()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<float>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<float>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average19()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(decimal)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(decimal));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average20()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<decimal>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<decimal>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average21()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average22()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<int?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new int?[] { default(int?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average23()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<long>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new long[] { default(long) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average24()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<long?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new long?[] { default(long?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average25()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<double>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new double[] { default(double) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average26()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<double?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new double?[] { default(double?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average27()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<float>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new float[] { default(float) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average28()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<float?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new float?[] { default(float?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average29()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new decimal[] { default(decimal) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average30()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Average(new decimal?[] { default(decimal?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average31()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<long>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<long>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average32()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(double), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(double), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average33()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<double>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<double>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average34()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(float), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(float), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average35()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<float>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<float>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average36()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(decimal), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(decimal), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average37()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<decimal>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<decimal>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average38()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<int>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average39()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Average40()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(default(IAsyncQueryable<int>), (int arg0) => default(long), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Average<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(long), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Buffer1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Buffer<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Buffer<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Buffer2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Buffer<int>(default(IAsyncQueryable<int>), 1, 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Buffer<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Cast1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Cast<int>(default(IAsyncQueryable<object>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Cast<int>(new object[] { default(object) }.ToAsyncEnumerable().AsAsyncQueryable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Catch1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Catch<int, Exception>(default(IAsyncQueryable<int>), (Exception arg0) => new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Catch<int, Exception>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<Exception, IAsyncEnumerable<int>>>)), ane => ane.ParamName == "handler");
-
-			var res = AsyncQueryable.Catch<int, Exception>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (Exception arg0) => new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Catch2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Catch<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Catch<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
-
-			var res = AsyncQueryable.Catch<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Concat1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Concat<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Concat<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
-
-			var res = AsyncQueryable.Concat<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Contains1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Contains<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Contains<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Contains2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Contains<int>(default(IAsyncQueryable<int>), 1, EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Contains<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Contains<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, EqualityComparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Contains3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Contains<int>(default(IAsyncQueryable<int>), 1, CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Contains<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Contains4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Contains<int>(default(IAsyncQueryable<int>), 1, EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Contains<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(IEqualityComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Contains<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, EqualityComparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Count1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Count<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Count<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Count2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Count<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Count<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Count3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Count<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Count<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Count<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Count4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Count<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Count<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Count<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void DefaultIfEmpty1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DefaultIfEmpty<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.DefaultIfEmpty<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void DefaultIfEmpty2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DefaultIfEmpty<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.DefaultIfEmpty<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Distinct1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Distinct<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Distinct<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Distinct2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Distinct<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Distinct3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Distinct<int>(default(IAsyncQueryable<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Distinct<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Distinct<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Distinct4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Distinct<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Distinct<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void DistinctUntilChanged1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DistinctUntilChanged<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.DistinctUntilChanged<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void DistinctUntilChanged2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DistinctUntilChanged<int>(default(IAsyncQueryable<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DistinctUntilChanged<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.DistinctUntilChanged<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void DistinctUntilChanged3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DistinctUntilChanged<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void DistinctUntilChanged4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DistinctUntilChanged<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.DistinctUntilChanged<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Do1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(default(IAsyncQueryable<int>), (int arg0) => Console.WriteLine()), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Action<int>>)), ane => ane.ParamName == "onNext");
-
-			var res = AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Do2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(default(IAsyncQueryable<int>), new NopObserver<int>()), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IObserver<int>)), ane => ane.ParamName == "observer");
-
-			var res = AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new NopObserver<int>());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Do3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(default(IAsyncQueryable<int>), (int arg0) => Console.WriteLine(), () => { }), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Action<int>>), () => { }), ane => ane.ParamName == "onNext");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), default(Action)), ane => ane.ParamName == "onCompleted");
-
-			var res = AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), () => { });
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Do4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(default(IAsyncQueryable<int>), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine()), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Action<int>>), (Exception arg0) => Console.WriteLine()), ane => ane.ParamName == "onNext");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), default(Expression<Action<Exception>>)), ane => ane.ParamName == "onError");
-
-			var res = AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Do5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(default(IAsyncQueryable<int>), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine(), () => { }), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Action<int>>), (Exception arg0) => Console.WriteLine(), () => { }), ane => ane.ParamName == "onNext");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), default(Expression<Action<Exception>>), () => { }), ane => ane.ParamName == "onError");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine(), default(Action)), ane => ane.ParamName == "onCompleted");
-
-			var res = AsyncQueryable.Do<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => Console.WriteLine(), (Exception arg0) => Console.WriteLine(), () => { });
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void ElementAt1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ElementAt<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.ElementAt<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ElementAt2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ElementAt<int>(default(IAsyncQueryable<int>), 1, CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.ElementAt<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ElementAtOrDefault1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ElementAtOrDefault<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.ElementAtOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ElementAtOrDefault2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ElementAtOrDefault<int>(default(IAsyncQueryable<int>), 1, CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.ElementAtOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Except1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Except<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Except<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
-
-			var res = AsyncQueryable.Except<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Except2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Except<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Except<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "second");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Except<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Except<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Expand1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Expand<int>(default(IAsyncQueryable<int>), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Expand<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, IAsyncEnumerable<int>>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Expand<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable());
-			res = res.Take(5);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Finally1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Finally<int>(default(IAsyncQueryable<int>), () => { }), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Finally<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Action)), ane => ane.ParamName == "finallyAction");
-
-			var res = AsyncQueryable.Finally<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), () => { });
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void First1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.First<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.First<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void First2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.First<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.First<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.First<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void First3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.First<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.First<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void First4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.First<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.First<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.First<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void FirstOrDefault1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.FirstOrDefault<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.FirstOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void FirstOrDefault2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.FirstOrDefault<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.FirstOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.FirstOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void FirstOrDefault3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.FirstOrDefault<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.FirstOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void FirstOrDefault4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.FirstOrDefault<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.FirstOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.FirstOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void GroupBy1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.GroupBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupBy2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int)), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>)), ane => ane.ParamName == "elementSelector");
-
-			var res = AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupBy3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.GroupBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupBy4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, IAsyncEnumerable<int>, int>>)), ane => ane.ParamName == "resultSelector");
-
-			var res = AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupBy5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "elementSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupBy6()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "elementSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), default(Expression<Func<int, IAsyncEnumerable<int>, int>>)), ane => ane.ParamName == "resultSelector");
-
-			var res = AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupBy7()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, IAsyncEnumerable<int>, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "resultSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.GroupBy<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupBy8()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "elementSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), default(Expression<Func<int, IAsyncEnumerable<int>, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "resultSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.GroupBy<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupJoin1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "outer");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "inner");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(Expression<Func<int, int>>), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "outerKeySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), default(Expression<Func<int, int>>), (int arg0, IAsyncEnumerable<int> arg1) => default(int)), ane => ane.ParamName == "innerKeySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), default(Expression<Func<int, IAsyncEnumerable<int>, int>>)), ane => ane.ParamName == "resultSelector");
-
-			var res = AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void GroupJoin2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "outer");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "inner");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(Expression<Func<int, int>>), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "outerKeySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), default(Expression<Func<int, int>>), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "innerKeySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), default(Expression<Func<int, IAsyncEnumerable<int>, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "resultSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.GroupJoin<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, IAsyncEnumerable<int> arg1) => default(int), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void IgnoreElements1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.IgnoreElements<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.IgnoreElements<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Intersect1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Intersect<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Intersect<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
-
-			var res = AsyncQueryable.Intersect<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Intersect2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Intersect<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Intersect<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "second");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Intersect<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Intersect<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void IsEmpty1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.IsEmpty<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.IsEmpty<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void IsEmpty2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.IsEmpty<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.IsEmpty<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Join1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "outer");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), (int arg0) => default(int), (int arg0) => default(int), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "inner");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(Expression<Func<int, int>>), (int arg0) => default(int), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "outerKeySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), default(Expression<Func<int, int>>), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "innerKeySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "resultSelector");
-
-			var res = AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, int arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Join2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, int arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "outer");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), (int arg0) => default(int), (int arg0) => default(int), (int arg0, int arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "inner");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(Expression<Func<int, int>>), (int arg0) => default(int), (int arg0, int arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "outerKeySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), default(Expression<Func<int, int>>), (int arg0, int arg1) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "innerKeySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), default(Expression<Func<int, int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "resultSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, int arg1) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Join<int, int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0) => default(int), (int arg0) => default(int), (int arg0, int arg1) => default(int), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Last1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Last<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Last<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Last2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Last<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Last<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Last<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Last3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Last<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Last<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Last4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Last<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Last<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Last<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void LastOrDefault1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LastOrDefault<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.LastOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void LastOrDefault2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LastOrDefault<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LastOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.LastOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void LastOrDefault3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LastOrDefault<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.LastOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void LastOrDefault4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LastOrDefault<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LastOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.LastOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void LongCount1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LongCount<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.LongCount<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void LongCount2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LongCount<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.LongCount<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void LongCount3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LongCount<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LongCount<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.LongCount<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void LongCount4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LongCount<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.LongCount<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.LongCount<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<long>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new long[] { default(long) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<double>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new double[] { default(double) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<float>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new float[] { default(float) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new decimal[] { default(decimal) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max6()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new int?[] { default(int?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max7()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new long?[] { default(long?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max8()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new double?[] { default(double?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max9()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new float?[] { default(float?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max10()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new decimal?[] { default(decimal?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max11()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max12()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<int>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<int>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max13()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<long>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<long>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max14()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<double>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<double>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max15()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<float>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<float>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max16()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<decimal>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<decimal>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max17()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max18()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), Comparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), Comparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max19()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max20()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<long>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new long[] { default(long) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max21()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<double>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new double[] { default(double) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max22()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<float>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new float[] { default(float) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max23()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new decimal[] { default(decimal) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max24()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new int?[] { default(int?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max25()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new long?[] { default(long?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max26()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new double?[] { default(double?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max27()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new float?[] { default(float?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max28()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max(new decimal?[] { default(decimal?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max29()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max30()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max31()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(long)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(long));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max32()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(double)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(double));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max33()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(float)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(float));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max34()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(decimal)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(decimal));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max35()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), Comparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max36()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max37()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(long), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(long), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max38()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(double), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(double), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max39()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(float), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(float), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max40()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(decimal), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(decimal), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max41()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<int>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max42()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<long>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<long>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max43()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<double>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<double>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max44()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<float>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<float>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max45()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<decimal>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<decimal>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Max46()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Max<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Max<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void MaxBy1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void MaxBy2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), Comparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), Comparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void MaxBy3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void MaxBy4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.MaxBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), Comparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<long>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new long[] { default(long) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<double>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new double[] { default(double) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<float>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new float[] { default(float) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new decimal[] { default(decimal) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min6()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new int?[] { default(int?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min7()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new long?[] { default(long?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min8()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new double?[] { default(double?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min9()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new float?[] { default(float?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min10()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new decimal?[] { default(decimal?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min11()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min12()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<decimal>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<decimal>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min13()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min14()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min15()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(long)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(long));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min16()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(double)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(double));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min17()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(float)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(float));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min18()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(decimal)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(decimal));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min19()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<int>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<int>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min20()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<long>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<long>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min21()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<double>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<double>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min22()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min23()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<long>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new long[] { default(long) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min24()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<double>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new double[] { default(double) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min25()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<float>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new float[] { default(float) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min26()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new decimal[] { default(decimal) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min27()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new int?[] { default(int?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min28()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new long?[] { default(long?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min29()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new double?[] { default(double?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min30()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new float?[] { default(float?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min31()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min(new decimal?[] { default(decimal?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min32()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min33()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), Comparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), Comparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min34()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<float>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<float>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min35()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), Comparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min36()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min37()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(long), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(long), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min38()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(double), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(double), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min39()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(float), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(float), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min40()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(decimal), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(decimal), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min41()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<int>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min42()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<long>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<long>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min43()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<double>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<double>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min44()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<float>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<float>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min45()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<decimal>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<decimal>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Min46()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Min<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Min<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void MinBy1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void MinBy2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), Comparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), Comparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void MinBy3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void MinBy4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), Comparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.MinBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), Comparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void OfType1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OfType<int>(default(IAsyncQueryable<object>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.OfType<int>(new object[] { default(object) }.ToAsyncEnumerable().AsAsyncQueryable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void OnErrorResumeNext1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OnErrorResumeNext<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OnErrorResumeNext<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
-
-			var res = AsyncQueryable.OnErrorResumeNext<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void OrderBy1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.OrderBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-		}
-
-		[Fact]
-		public void OrderBy2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderBy<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), Comparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.OrderBy<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), Comparer<int>.Default);
-		}
-
-		[Fact]
-		public void OrderByDescending1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderByDescending<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderByDescending<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.OrderByDescending<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-		}
-
-		[Fact]
-		public void OrderByDescending2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderByDescending<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderByDescending<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), Comparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.OrderByDescending<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.OrderByDescending<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), Comparer<int>.Default);
-		}
-
-		[Fact]
-		public void Prepend1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Prepend<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Prepend<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Repeat1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Repeat<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Repeat<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			res = res.Take(5);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Repeat2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Repeat<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Repeat<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			res = res.Take(5);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Retry1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Retry<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Retry<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Retry2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Retry<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Retry<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Reverse1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Reverse<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Reverse<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Scan1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Scan<int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Scan<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "accumulator");
-
-			var res = AsyncQueryable.Scan<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Scan2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Scan<int, int>(default(IAsyncQueryable<int>), 1, (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Scan<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "accumulator");
-
-			var res = AsyncQueryable.Scan<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1, (int arg0, int arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Select1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Select<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Select<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Select<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Select2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Select<int, int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Select<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Select<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SelectMany1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "other");
-
-			var res = AsyncQueryable.SelectMany<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SelectMany2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int>(default(IAsyncQueryable<int>), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, IAsyncEnumerable<int>>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.SelectMany<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SelectMany3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, IAsyncEnumerable<int>>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.SelectMany<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SelectMany4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable(), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, IAsyncEnumerable<int>>>), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "selector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable(), default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "resultSelector");
-
-			var res = AsyncQueryable.SelectMany<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => new int[] { default(int) }.ToAsyncEnumerable(), (int arg0, int arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SelectMany5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int, int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => new int[] { default(int) }.ToAsyncEnumerable(), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, IAsyncEnumerable<int>>>), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "selector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SelectMany<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => new int[] { default(int) }.ToAsyncEnumerable(), default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "resultSelector");
-
-			var res = AsyncQueryable.SelectMany<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => new int[] { default(int) }.ToAsyncEnumerable(), (int arg0, int arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SequenceEqual1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
-
-			var res = AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void SequenceEqual2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "second");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void SequenceEqual3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), CancellationToken.None), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), CancellationToken.None), ane => ane.ParamName == "second");
-
-			var res = AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void SequenceEqual4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "second");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(IEqualityComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.SequenceEqual<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Single1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Single<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Single<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Single2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Single<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Single<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Single<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Single3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Single<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Single<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Single4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Single<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Single<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Single<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void SingleOrDefault1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SingleOrDefault<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.SingleOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void SingleOrDefault2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SingleOrDefault<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SingleOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.SingleOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void SingleOrDefault3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SingleOrDefault<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.SingleOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void SingleOrDefault4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SingleOrDefault<int>(default(IAsyncQueryable<int>), (int arg0) => true, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SingleOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>), CancellationToken.None), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.SingleOrDefault<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Skip1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Skip<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Skip<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SkipLast1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SkipLast<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.SkipLast<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SkipWhile1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SkipWhile<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SkipWhile<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.SkipWhile<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void SkipWhile2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SkipWhile<int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.SkipWhile<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.SkipWhile<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => true);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void StartWith1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.StartWith<int>(default(IAsyncQueryable<int>), new int[] { default(int) }), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.StartWith<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(int[])), ane => ane.ParamName == "values");
-
-			var res = AsyncQueryable.StartWith<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) });
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Sum1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new long[] { default(long) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new double[] { default(double) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new float[] { default(float) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new decimal[] { default(decimal) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum6()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new int?[] { default(int?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum7()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new long?[] { default(long?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum8()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new double?[] { default(double?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum9()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new float?[] { default(float?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum10()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new decimal?[] { default(decimal?) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum11()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum12()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new long[] { default(long) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum13()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new double[] { default(double) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum14()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new float[] { default(float) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum15()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new decimal[] { default(decimal) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum16()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new int?[] { default(int?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum17()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new long?[] { default(long?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum18()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new double?[] { default(double?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum19()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new float?[] { default(float?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum20()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Sum(new decimal?[] { default(decimal?) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum21()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum22()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(long)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(long));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum23()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(double)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(double));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum24()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(float)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(float));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum25()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(decimal)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(decimal));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum26()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<int>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<int>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum27()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<long>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<long>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum28()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<double>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<double>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum29()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<float>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<float>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum30()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<decimal>)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal?>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<decimal>));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum31()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum32()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(long), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(long), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum33()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(double), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(double), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum34()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(float), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(float), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum35()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(decimal), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(decimal), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum36()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<int>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum37()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<long>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, long?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<long>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum38()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<double>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, double?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<double>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum39()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<float>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, float?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<float>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Sum40()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(default(IAsyncQueryable<int>), (int arg0) => default(Nullable<decimal>), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, decimal?>>), CancellationToken.None), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Sum<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(Nullable<decimal>), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Take1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Take<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.Take<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void TakeLast1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.TakeLast<int>(default(IAsyncQueryable<int>), 1), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.TakeLast<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), 1);
-			// TODO: investigate test hang
-		}
-
-		[Fact]
-		public void TakeWhile1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.TakeWhile<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.TakeWhile<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.TakeWhile<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void TakeWhile2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.TakeWhile<int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.TakeWhile<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.TakeWhile<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => true);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void ThenBy1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenBy<int, int>(default(IOrderedAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenBy<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.ThenBy<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), (int arg0) => default(int));
-		}
-
-		[Fact]
-		public void ThenBy2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenBy<int, int>(default(IOrderedAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenBy<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), default(Expression<Func<int, int>>), Comparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenBy<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), (int arg0) => default(int), default(IComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ThenBy<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), (int arg0) => default(int), Comparer<int>.Default);
-		}
-
-		[Fact]
-		public void ThenByDescending1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenByDescending<int, int>(default(IOrderedAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenByDescending<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.ThenByDescending<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), (int arg0) => default(int));
-		}
-
-		[Fact]
-		public void ThenByDescending2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenByDescending<int, int>(default(IOrderedAsyncQueryable<int>), (int arg0) => default(int), Comparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenByDescending<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), default(Expression<Func<int, int>>), Comparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ThenByDescending<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), (int arg0) => default(int), default(IComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ThenByDescending<int, int>(new int[0].ToAsyncEnumerable().AsAsyncQueryable().OrderBy(x => x), (int arg0) => default(int), Comparer<int>.Default);
-		}
-
-		[Fact]
-		public void ToArray1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToArray<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.ToArray<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToArray2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToArray<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.ToArray<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToDictionary1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToDictionary2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int)), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>)), ane => ane.ParamName == "elementSelector");
-
-			var res = AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToDictionary3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToDictionary4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToDictionary5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "elementSelector");
-
-			var res = AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToDictionary6()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IEqualityComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ToDictionary<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToDictionary7()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "elementSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToDictionary8()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "elementSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), default(IEqualityComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ToDictionary<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToList1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToList<int>(default(IAsyncQueryable<int>)), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.ToList<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable());
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToList2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToList<int>(default(IAsyncQueryable<int>), CancellationToken.None), ane => ane.ParamName == "source");
-
-			var res = AsyncQueryable.ToList<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToLookup1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>)), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToLookup2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int)), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int)), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>)), ane => ane.ParamName == "elementSelector");
-
-			var res = AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int));
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToLookup3()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToLookup4()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "keySelector");
-
-			var res = AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToLookup5()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), EqualityComparer<int>.Default), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), EqualityComparer<int>.Default), ane => ane.ParamName == "elementSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToLookup6()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), CancellationToken.None), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), CancellationToken.None), ane => ane.ParamName == "elementSelector");
-
-			var res = AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToLookup7()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(IEqualityComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ToLookup<int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void ToLookup8()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(default(IAsyncQueryable<int>), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int>>), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "keySelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), default(Expression<Func<int, int>>), EqualityComparer<int>.Default, CancellationToken.None), ane => ane.ParamName == "elementSelector");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), default(IEqualityComparer<int>), CancellationToken.None), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.ToLookup<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => default(int), (int arg0) => default(int), EqualityComparer<int>.Default, CancellationToken.None);
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-		}
-
-		[Fact]
-		public void Union1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Union<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable()), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Union<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>)), ane => ane.ParamName == "second");
-
-			var res = AsyncQueryable.Union<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable());
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Union2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Union<int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Union<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), EqualityComparer<int>.Default), ane => ane.ParamName == "second");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Union<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(IEqualityComparer<int>)), ane => ane.ParamName == "comparer");
-
-			var res = AsyncQueryable.Union<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), EqualityComparer<int>.Default);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Where1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Where<int>(default(IAsyncQueryable<int>), (int arg0) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Where<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Where<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0) => true);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Where2()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Where<int>(default(IAsyncQueryable<int>), (int arg0, int arg1) => true), ane => ane.ParamName == "source");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Where<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(Expression<Func<int, int, bool>>)), ane => ane.ParamName == "predicate");
-
-			var res = AsyncQueryable.Where<int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), (int arg0, int arg1) => true);
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-		[Fact]
-		public void Zip1()
-		{
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Zip<int, int, int>(default(IAsyncQueryable<int>), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "first");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Zip<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), default(IAsyncEnumerable<int>), (int arg0, int arg1) => default(int)), ane => ane.ParamName == "second");
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.Zip<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), default(Expression<Func<int, int, int>>)), ane => ane.ParamName == "selector");
-
-			var res = AsyncQueryable.Zip<int, int, int>(new int[] { default(int) }.ToAsyncEnumerable().AsAsyncQueryable(), new int[] { default(int) }.ToAsyncEnumerable(), (int arg0, int arg1) => default(int));
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-		}
-
-	}
-}

+ 0 - 474
Ix.NET/Source/System.Interactive.Async.Tests/AsyncQueryableTests.Generated.tt

@@ -1,474 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ assembly name="System.Core" #>
-<#@ assembly name="$(ProjectDir)\..\System.Interactive.Async\bin\$(Configuration)\net45\System.Interactive.Async.dll" #>
-<#@ import namespace="System.Linq" #>
-<#@ import namespace="System.Text" #>
-<#@ import namespace="System.Threading" #>
-<#@ import namespace="System.Threading.Tasks" #>
-<#@ import namespace="System.Collections.Generic" #>
-<#@ output extension=".cs" #>
-<#
-var failing = new[] { "TakeLast" };
-var exclude = new[] { "ForEach", "ForEachAsync", "ToEnumerable", "ToAsyncEnumerable", "ToObservable", "AsAsyncEnumerable" };
-
-var toQuotedImpl = default(Func<Type, int, bool, string>);
-toQuotedImpl = (t, i, b) =>
-{
-var name = t.Name;
-
-if (t.IsGenericType)
-{
-	var genDef = t.GetGenericTypeDefinition();
-	name = genDef.Name.Substring(0, genDef.Name.LastIndexOf('`'));
-
-	var genArgs = "<" + string.Join(", ", t.GetGenericArguments().Select(a => toQuotedImpl(a, i, false))) + ">";
-
-	if (b)
-	{
-		if (name == "Func" || name == "Action")
-		{
-			name = "Expression<" + name + genArgs + ">";
-		}
-		else if (name == "IAsyncEnumerable" && i == 0)
-		{
-			name = "IAsyncQueryable" + genArgs;
-		}
-		else if (name == "IOrderedAsyncEnumerable" && i == 0)
-		{
-			name = "IOrderedAsyncQueryable" + genArgs;
-		}
-		else
-		{
-			name += genArgs;
-		}
-	}
-	else
-	{
-		if (name == "Nullable")
-		{
-			name = genArgs.Substring(1, genArgs.Length - 2) + "?";
-		}
-		else
-		{
-			name += genArgs;
-		}
-	}
-}
-else if (t.IsArray)
-{
-	var elem = toQuotedImpl(t.GetElementType(), i, b);
-	name = elem + "[]";
-}
-else
-{
-	if (t == typeof(int))
-	{
-		name = "int";
-	}
-	else if (t == typeof(long))
-	{
-		name = "long";
-	}
-	else if (t == typeof(float))
-	{
-		name = "float";
-	}
-	else if (t == typeof(double))
-	{
-		name = "double";
-	}
-	else if (t == typeof(decimal))
-	{
-		name = "decimal";
-	}
-	else if (t == typeof(bool))
-	{
-		name = "bool";
-	}
-	else if (t == typeof(object))
-	{
-		name = "object";
-	}
-}
-
-return name;
-};
-
-var toQuoted = new Func<Type, int, string>((t, i) => toQuotedImpl(t, i, true));
-
-var index = new Dictionary<string, int>();
-#>
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Threading;
-using Xunit;
-
-namespace Tests
-{
-	
-	public class AsyncQueryableTests
-	{
-<#
-// NOTE: Just including extension methods
-foreach (var m in typeof(AsyncEnumerable).GetMethods()
-						.Where(m => m.IsStatic)
-						.Where(m => !exclude.Contains(m.Name))
-						.Where(m => m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))
-						.Where(m =>
-						{
-							var p0 = m.GetParameters()[0].ParameterType;
-							if (p0.IsGenericType)
-							{
-								var p0d = p0.GetGenericTypeDefinition();
-								return p0d == typeof(IAsyncEnumerable<>) || p0d == typeof(IOrderedAsyncEnumerable<>);
-							}
-
-							return false;
-						})
-						.OrderBy(m => m.Name)
-						.ThenBy(m => m.GetParameters().Length))
-{
-	var genArgs = m.GetGenericArguments();
-
-	var ret = toQuoted(m.ReturnType, 0);
-	var name = m.Name;
-
-	if (genArgs.Length > 0)
-	{
-		name += "<" + string.Join(", ", genArgs.Select(a => a.Name)) + ">";
-	}
-
-	var isParams = false;
-	var parCount = m.GetParameters().Length;
-
-	if (parCount != 0)
-	{
-		if (m.GetParameters().Last().IsDefined(typeof(ParamArrayAttribute), true))
-		{
-			isParams = true;
-		}
-	}
-
-	var pars = string.Join(", ", m.GetParameters().Select((p, i) => (i == parCount - 1 && isParams ? "params " : "") + toQuoted(p.ParameterType, i) + " " + p.Name));
-
-	if (m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))
-	{
-		pars = "this " + pars;
-	}
-
-	var mtd = "(MethodInfo)MethodBase.GetCurrentMethod()";
-
-	if (m.IsGenericMethod)
-	{
-		mtd = "(" + mtd + ").MakeGenericMethod(" + string.Join(", ", genArgs.Select(a => "typeof(" + a.Name + ")")) + ")";
-	}
-
-	var provider = m.GetParameters()[0].Name + ".Provider";
-	var factory = "";
-	var rem = "";
-	var cast = "";
-	var quotedArgs = new List<string>();
-
-	if (m.ReturnType.IsGenericType)
-	{
-		var td = m.ReturnType.GetGenericTypeDefinition();
-
-		if (td == typeof(Task<>))
-		{
-			factory = "ExecuteAsync<" + toQuotedImpl(m.ReturnType.GetGenericArguments()[0], -1, false) + ">";
-
-			var last = m.GetParameters().Last();
-			if (last.ParameterType == typeof(CancellationToken))
-			{
-				rem = ", " + last.Name;
-			}
-			else
-			{
-				rem = ", CancellationToken.None";
-			}
-		}
-		else if (td == typeof(IAsyncEnumerable<>) || td == typeof(IOrderedAsyncEnumerable<>))
-		{
-			factory = "CreateQuery<" + toQuotedImpl(m.ReturnType.GetGenericArguments()[0], -1, false) + ">";
-
-			if (td == typeof(IOrderedAsyncEnumerable<>))
-			{
-				cast = "(" + toQuoted(m.ReturnType, 0) + ")";
-			}
-		}
-	}
-
-	var n = 0;
-	foreach (var p in m.GetParameters())
-	{
-		var pt = p.ParameterType;
-
-		var add = false;
-
-		if (pt.IsGenericType)
-		{
-			var ptd = pt.GetGenericTypeDefinition();
-
-			if (ptd == typeof(IAsyncEnumerable<>) || ptd == typeof(IOrderedAsyncEnumerable<>))
-			{
-				if (n == 0)
-				{
-					quotedArgs.Add(p.Name + ".Expression");
-				}
-				else
-				{
-					quotedArgs.Add("GetSourceExpression(" + p.Name + ")");
-				}
-				add = true;
-			}
-			else if (ptd.Name.StartsWith("Func") || ptd.Name.StartsWith("Action"))
-			{
-				quotedArgs.Add(p.Name);
-				add = true;
-			}
-		}
-		
-		if (!add)
-		{
-			quotedArgs.Add("Expression.Constant(" + p.Name + ", typeof(" + toQuoted(pt, -1) + "))");
-		}
-
-		n++;
-	}
-
-	var expr = "Expression.Call(" + mtd + ", " + string.Join(", ", quotedArgs) + ")";
-
-	var testName = m.Name;
-
-	var num = 0;
-	if (!index.TryGetValue(testName, out num))
-	{
-		index[testName] = 0;
-	}
-
-	index[testName] = num + 1;
-
-	testName += (num + 1);
-#>
-		[Fact]
-		public void <#=testName#>()
-		{
-<#
-var indexes = new List<int>();
-var j = 0;
-foreach (var p in m.GetParameters())
-{
-	if (!p.ParameterType.IsValueType && !p.ParameterType.IsGenericParameter)
-	{
-		indexes.Add(j);
-	}
-
-	j++;
-}
-
-var tm = m;
-
-if (tm.IsGenericMethodDefinition)
-{
-	tm = m.MakeGenericMethod(m.GetGenericArguments().Select(a =>
-	{
-		var cs = a.GetGenericParameterConstraints();
-		if (cs.Length > 0)
-		{
-			var bc = cs.FirstOrDefault(c => c.IsClass);
-			if (bc != null)
-			{
-				return bc;
-			}
-		}
-
-		return typeof(int);
-	}).ToArray());
-}
-
-var opName = tm.Name;
-
-if (tm.IsGenericMethod)
-{
-	opName += "<" + string.Join(", ", tm.GetGenericArguments().Select(a => toQuotedImpl(a, -1, false))) + ">";
-}
-
-var getVal = default(Func<Type, int, string>);
-getVal = (tp, pos) =>
-{
-	if (tp.IsGenericType)
-	{
-		var tpd = tp.GetGenericTypeDefinition();
-
-		if (tpd == typeof(IAsyncEnumerable<>))
-		{
-			var tpa = tp.GetGenericArguments()[0];
-			var et = toQuotedImpl(tpa, -1, false);
-			var res = "new " + et + "[] { default(" + et + ") }.ToAsyncEnumerable()";
-
-			if (pos == 0)
-			{
-				res += ".AsAsyncQueryable()";
-			}
-
-			return res;
-		}
-		else if (tpd == typeof(IOrderedAsyncEnumerable<>))
-		{
-			var tpa = tp.GetGenericArguments()[0];
-			var res = "new " + toQuotedImpl(tpa, -1, false) + "[0].ToAsyncEnumerable()";
-
-			if (pos == 0)
-			{
-				res += ".AsAsyncQueryable()";
-			}
-
-			return res + ".OrderBy(x => x)";
-		}
-		else if (tpd.Name.StartsWith("Func"))
-		{
-			var inv = tp.GetMethod("Invoke");
-				
-			var largs = string.Join(", ", inv.GetParameters().Select((lp, lpi) => toQuoted(lp.ParameterType, -1) + " arg" + lpi).ToArray());
-
-			var lret = "default(" + toQuoted(inv.ReturnType, -1) + ")";
-
-			if (inv.ReturnType.IsGenericType)
-			{
-				if (inv.ReturnType.GetGenericTypeDefinition() == typeof(IAsyncEnumerable<>))
-				{
-					var tpa = inv.ReturnType.GetGenericArguments()[0];
-					var et = toQuotedImpl(tpa, -1, false);
-					lret = "new " + et + "[] { default(" + et + ") }.ToAsyncEnumerable()";
-				}
-			}
-			else if (inv.ReturnType == typeof(bool))
-			{
-				lret = "true";
-			}
-
-			return "(" + largs + ") => " + lret;
-		}
-		else if (tpd.Name.StartsWith("Action"))
-		{
-			var inv = tp.GetMethod("Invoke");
-				
-			var largs = string.Join(", ", inv.GetParameters().Select((lp, lpi) => toQuoted(lp.ParameterType, -1) + " arg" + lpi).ToArray());
-			var lret = "Console.WriteLine()";
-
-			return "(" + largs + ") => " + lret;
-		}
-		else if (tpd == typeof(IEqualityComparer<>))
-		{
-			var tpa = tp.GetGenericArguments()[0];
-
-			return "EqualityComparer<" + toQuotedImpl(tpa, -1, false) + ">.Default";
-		}
-		else if (tpd == typeof(IComparer<>))
-		{
-			var tpa = tp.GetGenericArguments()[0];
-
-			return "Comparer<" + toQuotedImpl(tpa, -1, false) + ">.Default";
-		}
-		else if (tpd == typeof(IObserver<>))
-		{
-			var tpa = tp.GetGenericArguments()[0];
-
-			return "new NopObserver<" + toQuotedImpl(tpa, -1, false) + ">()";
-		}
-	}
-	else if (tp == typeof(CancellationToken))
-	{
-		return "CancellationToken.None";
-	}
-	else if (tp == typeof(Action))
-	{
-		return "() => { }";
-	}
-	else if (tp.IsArray)
-	{
-		var tpa = tp.GetElementType();
-		var et = toQuotedImpl(tpa, -1, false);
-
-		return "new " + et + "[] { default(" + et + ") }";
-	}
-	else if (tp == typeof(int))
-	{
-		return "1";
-	}
-
-	return "default(" + toQuoted(tp, pos) + ")";
-};
-
-var vals = tm.GetParameters().Select((p, i) => getVal(p.ParameterType, i)).ToArray();
-var nulls = tm.GetParameters().Select((p, i) => "default(" + toQuoted(p.ParameterType, i) + ")").ToArray();
-
-var len = vals.Length;
-
-if (indexes.Count != 0)
-{
-	foreach (var idx in indexes)
-	{
-		var args = string.Join(", ", Enumerable.Range(0, len).Select(k => k == idx ? nulls[k] : vals[k]).ToArray());
-		var nullArg = tm.GetParameters()[idx].Name;
-#>
-			AssertEx.Throws<ArgumentNullException>(() => AsyncQueryable.<#=opName#>(<#=args#>), ane => ane.ParamName == "<#=nullArg#>");
-<#
-	}
-#>
-
-<#
-}
-
-{
-	var args = string.Join(", ", vals);
-#>
-			var res = AsyncQueryable.<#=opName#>(<#=args#>);
-<#
-	var tmRet = tm.ReturnType;
-
-	if (tmRet.IsGenericType)
-	{
-		tmRet = tmRet.GetGenericTypeDefinition();
-	}
-
-	if (tm.Name == "Repeat" || tm.Name == "Expand")
-	{
-#>
-			res = res.Take(5);
-<#
-	}
-
-	if (!failing.Contains(tm.Name))
-	{
-		if (tmRet == typeof(Task<>))
-		{
-#>
-			AssertEx.SucceedOrFailProper(() => res.Wait());
-<#
-		}
-		else if (tmRet == typeof(IAsyncEnumerable<>))
-		{
-#>
-			var task = res.ForEachAsync(_ => { });
-			AssertEx.SucceedOrFailProper(() => task.Wait());
-<#
-		}
-	}
-	else
-	{
-#>
-			// TODO: investigate test hang
-<#
-	}
-}
-#>
-		}
-
-<#
-}
-#>
-	}
-}

+ 0 - 2222
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Aggregates.cs

@@ -1,2222 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit;
-// ReSharper disable InvokeAsExtensionMethod
-// ReSharper disable InconsistentNaming
-// ReSharper disable RedundantTypeArgumentsOfMethod
-
-namespace Tests
-{
-    public partial class AsyncTests
-    {
-        private const int WaitTimeoutMs = 5000;
-
-        [Fact]
-        public async Task Aggregate_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int>(null, (x, y) => x + y));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int>(null, 0, (x, y) => x + y));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int>(AsyncEnumerable.Return(42), 0, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int, int>(null, 0, (x, y) => x + y, z => z));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int, int>(AsyncEnumerable.Return(42), 0, null, z => z));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int, int>(AsyncEnumerable.Return(42), 0, (x, y) => x + y, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int>(null, (x, y) => x + y, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int>(null, 0, (x, y) => x + y, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int>(AsyncEnumerable.Return(42), 0, null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int, int>(null, 0, (x, y) => x + y, z => z, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int, int>(AsyncEnumerable.Return(42), 0, null, z => z, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Aggregate<int, int, int>(AsyncEnumerable.Return(42), 0, (x, y) => x + y, null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void Aggregate1()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Aggregate((x, y) => x * y);
-            Assert.Equal(24, ys.Result);
-        }
-
-        [Fact]
-        public void Aggregate2()
-        {
-            var xs = new int[0].ToAsyncEnumerable();
-            var ys = xs.Aggregate((x, y) => x * y);
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Aggregate3()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Aggregate((x, y) => x * y);
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Aggregate4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Aggregate((x, y) => { throw ex; });
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Aggregate5()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Aggregate(1, (x, y) => x * y);
-            Assert.Equal(24, ys.Result);
-        }
-
-        [Fact]
-        public void Aggregate6()
-        {
-            var xs = new int[0].ToAsyncEnumerable();
-            var ys = xs.Aggregate(1, (x, y) => x * y);
-            Assert.Equal(1, ys.Result);
-        }
-
-        [Fact]
-        public void Aggregate7()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Aggregate(1, (x, y) => x * y);
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Aggregate8()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Aggregate(1, (x, y) => { throw ex; });
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Aggregate9()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1);
-            Assert.Equal(25, ys.Result);
-        }
-
-        [Fact]
-        public void Aggregate10()
-        {
-            var xs = new int[0].ToAsyncEnumerable();
-            var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1);
-            Assert.Equal(2, ys.Result);
-        }
-
-        [Fact]
-        public void Aggregate11()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1);
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Aggregate12()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Aggregate(1, (x, y) => { throw ex; }, x => x + 1);
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Aggregate13()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Aggregate<int, int, int>(1, (x, y) => x * y, x => { throw ex; });
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Count_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Count<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Count<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Count<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Count<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Count<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Count<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void Count1()
-        {
-            Assert.Equal(0, new int[0].ToAsyncEnumerable().Count().Result);
-            Assert.Equal(3, new[] { 1, 2, 3 }.ToAsyncEnumerable().Count().Result);
-            AssertThrows<AggregateException>(() => AsyncEnumerable.Throw<int>(new Exception("Bang!")).Count().Wait(WaitTimeoutMs));
-        }
-
-        [Fact]
-        public void Count2()
-        {
-            Assert.Equal(0, new int[0].ToAsyncEnumerable().Count(x => x < 3).Result);
-            Assert.Equal(2, new[] { 1, 2, 3 }.ToAsyncEnumerable().Count(x => x < 3).Result);
-            AssertThrows<AggregateException>(() => AsyncEnumerable.Throw<int>(new Exception("Bang!")).Count(x => x < 3).Wait(WaitTimeoutMs));
-        }
-
-        [Fact]
-        public void Count3()
-        {
-            var ex = new Exception("Bang!");
-            var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Count(x => { throw ex; });
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task LongCount_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LongCount<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LongCount<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LongCount<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LongCount<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LongCount<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LongCount<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void LongCount1()
-        {
-            Assert.Equal(0, new int[0].ToAsyncEnumerable().LongCount().Result);
-            Assert.Equal(3, new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount().Result);
-            AssertThrows<AggregateException>(() => AsyncEnumerable.Throw<int>(new Exception("Bang!")).LongCount().Wait(WaitTimeoutMs));
-        }
-
-        [Fact]
-        public void LongCount2()
-        {
-            Assert.Equal(0, new int[0].ToAsyncEnumerable().LongCount(x => x < 3).Result);
-            Assert.Equal(2, new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount(x => x < 3).Result);
-            AssertThrows<AggregateException>(() => AsyncEnumerable.Throw<int>(new Exception("Bang!")).LongCount(x => x < 3).Wait(WaitTimeoutMs));
-        }
-
-        [Fact]
-        public void LongCount3()
-        {
-            var ex = new Exception("Bang!");
-            var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount(x => { throw ex; });
-            AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task All_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.All<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.All<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.All<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.All<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void All1()
-        {
-            var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().All(x => x % 2 == 0);
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public void All2()
-        {
-            var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().All(x => x % 2 == 0);
-            Assert.True(res.Result);
-        }
-
-        [Fact]
-        public void All3()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).All(x => x % 2 == 0);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void All4()
-        {
-            var ex = new Exception("Bang!");
-            var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().All(x => { throw ex; });
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Any_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Any<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Any<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Any<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Any<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Any<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Any<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void Any1()
-        {
-            var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().Any(x => x % 2 == 0);
-            Assert.True(res.Result);
-        }
-
-        [Fact]
-        public void Any2()
-        {
-            var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().Any(x => x % 2 != 0);
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public void Any3()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Any(x => x % 2 == 0);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Any4()
-        {
-            var ex = new Exception("Bang!");
-            var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().Any(x => { throw ex; });
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Any5()
-        {
-            var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().Any();
-            Assert.True(res.Result);
-        }
-
-        [Fact]
-        public void Any6()
-        {
-            var res = new int[0].ToAsyncEnumerable().Any();
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public async Task Contains_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Contains<int>(null, 42));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Contains<int>(null, 42, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Contains<int>(AsyncEnumerable.Return(42), 42, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Contains<int>(null, 42, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Contains<int>(null, 42, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Contains<int>(AsyncEnumerable.Return(42), 42, null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void Contains1()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable();
-            var ys = xs.Contains(3);
-            Assert.True(ys.Result);
-        }
-
-        [Fact]
-        public void Contains2()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable();
-            var ys = xs.Contains(6);
-            Assert.False(ys.Result);
-        }
-
-        [Fact]
-        public void Contains3()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable();
-            var ys = xs.Contains(-3, new Eq());
-            Assert.True(ys.Result);
-        }
-
-        [Fact]
-        public void Contains4()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable();
-            var ys = xs.Contains(-6, new Eq());
-            Assert.False(ys.Result);
-        }
-
-        private class Eq : IEqualityComparer<int>
-        {
-            public bool Equals(int x, int y)
-            {
-                return EqualityComparer<int>.Default.Equals(Math.Abs(x), Math.Abs(y));
-            }
-
-            public int GetHashCode(int obj)
-            {
-                return EqualityComparer<int>.Default.GetHashCode(Math.Abs(obj));
-            }
-        }
-
-        [Fact]
-        public async Task First_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.First<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.First<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.First<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.First<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.First<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.First<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void First1()
-        {
-            var res = AsyncEnumerable.Empty<int>().First();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void First2()
-        {
-            var res = AsyncEnumerable.Empty<int>().First(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void First3()
-        {
-            var res = AsyncEnumerable.Return(42).First(x => x % 2 != 0);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void First4()
-        {
-            var res = AsyncEnumerable.Return(42).First();
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void First5()
-        {
-            var res = AsyncEnumerable.Return(42).First(x => x % 2 == 0);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void First6()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).First();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void First7()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).First(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void First8()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().First();
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void First9()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().First(x => x % 2 != 0);
-            Assert.Equal(45, res.Result);
-        }
-
-        [Fact]
-        public async Task FirstOrDefault_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.FirstOrDefault<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.FirstOrDefault<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.FirstOrDefault<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.FirstOrDefault<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.FirstOrDefault<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.FirstOrDefault<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void FirstOrDefault1()
-        {
-            var res = AsyncEnumerable.Empty<int>().FirstOrDefault();
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void FirstOrDefault2()
-        {
-            var res = AsyncEnumerable.Empty<int>().FirstOrDefault(x => true);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void FirstOrDefault3()
-        {
-            var res = AsyncEnumerable.Return(42).FirstOrDefault(x => x % 2 != 0);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void FirstOrDefault4()
-        {
-            var res = AsyncEnumerable.Return(42).FirstOrDefault();
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void FirstOrDefault5()
-        {
-            var res = AsyncEnumerable.Return(42).FirstOrDefault(x => x % 2 == 0);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void FirstOrDefault6()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).FirstOrDefault();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void FirstOrDefault7()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).FirstOrDefault(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void FirstOrDefault8()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault();
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void FirstOrDefault9()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault(x => x % 2 != 0);
-            Assert.Equal(45, res.Result);
-        }
-
-        [Fact]
-        public void FirstOrDefault10()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault(x => x < 10);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public async Task Last_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Last<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Last<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Last<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Last<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Last<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Last<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void Last1()
-        {
-            var res = AsyncEnumerable.Empty<int>().Last();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Last2()
-        {
-            var res = AsyncEnumerable.Empty<int>().Last(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Last3()
-        {
-            var res = AsyncEnumerable.Return(42).Last(x => x % 2 != 0);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Last4()
-        {
-            var res = AsyncEnumerable.Return(42).Last();
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void Last5()
-        {
-            var res = AsyncEnumerable.Return(42).Last(x => x % 2 == 0);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void Last6()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Last();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Last7()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Last(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Last8()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Last();
-            Assert.Equal(90, res.Result);
-        }
-
-        [Fact]
-        public void Last9()
-        {
-            var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().Last(x => x % 2 != 0);
-            Assert.Equal(45, res.Result);
-        }
-
-        [Fact]
-        public async Task LastOrDefault_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LastOrDefault<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LastOrDefault<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LastOrDefault<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LastOrDefault<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LastOrDefault<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.LastOrDefault<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void LastOrDefault1()
-        {
-            var res = AsyncEnumerable.Empty<int>().LastOrDefault();
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void LastOrDefault2()
-        {
-            var res = AsyncEnumerable.Empty<int>().LastOrDefault(x => true);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void LastOrDefault3()
-        {
-            var res = AsyncEnumerable.Return(42).LastOrDefault(x => x % 2 != 0);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void LastOrDefault4()
-        {
-            var res = AsyncEnumerable.Return(42).LastOrDefault();
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void LastOrDefault5()
-        {
-            var res = AsyncEnumerable.Return(42).LastOrDefault(x => x % 2 == 0);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void LastOrDefault6()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).LastOrDefault();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void LastOrDefault7()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).LastOrDefault(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void LastOrDefault8()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().LastOrDefault();
-            Assert.Equal(90, res.Result);
-        }
-
-        [Fact]
-        public void LastOrDefault9()
-        {
-            var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().LastOrDefault(x => x % 2 != 0);
-            Assert.Equal(45, res.Result);
-        }
-
-        [Fact]
-        public void LastOrDefault10()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().LastOrDefault(x => x < 10);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public async Task Single_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Single<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Single<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Single<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Single<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Single<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Single<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void Single1()
-        {
-            var res = AsyncEnumerable.Empty<int>().Single();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Single2()
-        {
-            var res = AsyncEnumerable.Empty<int>().Single(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Single3()
-        {
-            var res = AsyncEnumerable.Return(42).Single(x => x % 2 != 0);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Single4()
-        {
-            var res = AsyncEnumerable.Return(42).Single();
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void Single5()
-        {
-            var res = AsyncEnumerable.Return(42).Single(x => x % 2 == 0);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void Single6()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Single();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Single7()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Single(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Single8()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Single();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Single9()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Single(x => x % 2 != 0);
-            Assert.Equal(45, res.Result);
-        }
-
-        [Fact]
-        public void Single10()
-        {
-            var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().Single(x => x % 2 != 0);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Single11()
-        {
-            var res = new int[0].ToAsyncEnumerable().Single();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public async Task SingleOrDefault_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SingleOrDefault<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SingleOrDefault<int>(null, x => true));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SingleOrDefault<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SingleOrDefault<int>(null, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SingleOrDefault<int>(null, x => true, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SingleOrDefault<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void SingleOrDefault1()
-        {
-            var res = AsyncEnumerable.Empty<int>().SingleOrDefault();
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void SingleOrDefault2()
-        {
-            var res = AsyncEnumerable.Empty<int>().SingleOrDefault(x => true);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void SingleOrDefault3()
-        {
-            var res = AsyncEnumerable.Return(42).SingleOrDefault(x => x % 2 != 0);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void SingleOrDefault4()
-        {
-            var res = AsyncEnumerable.Return(42).SingleOrDefault();
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void SingleOrDefault5()
-        {
-            var res = AsyncEnumerable.Return(42).SingleOrDefault(x => x % 2 == 0);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void SingleOrDefault6()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).SingleOrDefault();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SingleOrDefault7()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).SingleOrDefault(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SingleOrDefault8()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void SingleOrDefault9()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => x % 2 != 0);
-            Assert.Equal(45, res.Result);
-        }
-
-        [Fact]
-        public void SingleOrDefault10()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => x < 10);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void SingleOrDefault11()
-        {
-            var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => true);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void SingleOrDefault12()
-        {
-            var res = new int[0].ToAsyncEnumerable().SingleOrDefault();
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public async Task ElementAt_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ElementAt<int>(null, 0));
-            await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => AsyncEnumerable.ElementAt<int>(AsyncEnumerable.Return(42), -1));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ElementAt<int>(null, 0, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => AsyncEnumerable.ElementAt<int>(AsyncEnumerable.Return(42), -1, CancellationToken.None));
-        }
-
-        [Fact]
-        public void ElementAt1()
-        {
-            var res = AsyncEnumerable.Empty<int>().ElementAt(0);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException);
-        }
-
-        [Fact]
-        public void ElementAt2()
-        {
-            var res = AsyncEnumerable.Return<int>(42).ElementAt(0);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void ElementAt3()
-        {
-            var res = AsyncEnumerable.Return<int>(42).ElementAt(1);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException);
-        }
-
-        [Fact]
-        public void ElementAt4()
-        {
-            var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAt(1);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void ElementAt5()
-        {
-            var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAt(7);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException);
-        }
-
-        [Fact]
-        public void ElementAt6()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).ElementAt(15);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task ElementAt7()
-        {
-            var en = new CancellationTestAsyncEnumerable(10);
-
-            var res = en.ElementAt(1);
-            Assert.Equal(1, await res);
-        }
-
-        [Fact]
-        public async Task ElementAtOrDefault_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ElementAtOrDefault<int>(null, 0));
-            await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => AsyncEnumerable.ElementAtOrDefault<int>(AsyncEnumerable.Return(42), -1));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ElementAtOrDefault<int>(null, 0, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => AsyncEnumerable.ElementAtOrDefault<int>(AsyncEnumerable.Return(42), -1, CancellationToken.None));
-        }
-
-        [Fact]
-        public void ElementAtOrDefault1()
-        {
-            var res = AsyncEnumerable.Empty<int>().ElementAtOrDefault(0);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void ElementAtOrDefault2()
-        {
-            var res = AsyncEnumerable.Return<int>(42).ElementAtOrDefault(0);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void ElementAtOrDefault3()
-        {
-            var res = AsyncEnumerable.Return<int>(42).ElementAtOrDefault(1);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void ElementAtOrDefault4()
-        {
-            var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAtOrDefault(1);
-            Assert.Equal(42, res.Result);
-        }
-
-        [Fact]
-        public void ElementAtOrDefault5()
-        {
-            var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAtOrDefault(7);
-            Assert.Equal(0, res.Result);
-        }
-
-        [Fact]
-        public void ElementAtOrDefault6()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).ElementAtOrDefault(15);
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task ToList_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToList<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToList<int>(null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void ToList1()
-        {
-            var xs = new[] { 42, 25, 39 };
-            var res = xs.ToAsyncEnumerable().ToList();
-            Assert.True(res.Result.SequenceEqual(xs));
-        }
-
-        [Fact]
-        public void ToList2()
-        {
-            var xs = AsyncEnumerable.Empty<int>();
-            var res = xs.ToList();
-            Assert.True(res.Result.Count == 0);
-        }
-
-        [Fact]
-        public void ToList3()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).ToList();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task ToArray_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToArray<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToArray<int>(null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void ToArray1()
-        {
-            var xs = new[] { 42, 25, 39 };
-            var res = xs.ToAsyncEnumerable().ToArray();
-            Assert.True(res.Result.SequenceEqual(xs));
-        }
-
-        [Fact]
-        public void ToArray2()
-        {
-            var xs = AsyncEnumerable.Empty<int>();
-            var res = xs.ToArray();
-            Assert.True(res.Result.Length == 0);
-        }
-
-        [Fact]
-        public void ToArray3()
-        {
-            var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).ToArray();
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task ToArray4()
-        {
-            var xs = await AsyncEnumerable.Range(5, 50).Take(10).ToArray();
-            var ex = new[] { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-
-            Assert.True(ex.SequenceEqual(xs));
-        }
-
-        [Fact]
-        public async Task ToArray5()
-        {
-            var res = new[] { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
-            var xs = new HashSet<int>(res);
-
-            var arr = await xs.ToAsyncEnumerable().ToArray();
-
-
-            Assert.True(res.SequenceEqual(arr));
-        }
-
-        [Fact]
-        public async Task ToDictionary_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(null, x => 0));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(null, x => 0, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(AsyncEnumerable.Return(42), null, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(AsyncEnumerable.Return(42), x => 0, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(null, x => 0, x => 0));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), null, x => 0));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), x => 0, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(null, x => 0, x => 0, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), x => 0, x => 0, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(null, x => 0, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(null, x => 0, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(AsyncEnumerable.Return(42), null, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int>(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(null, x => 0, x => 0, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), null, x => 0, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(null, x => 0, x => 0, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToDictionary<int, int, int>(AsyncEnumerable.Return(42), x => 0, x => 0, null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void ToDictionary1()
-        {
-            var xs = new[] { 1, 4 }.ToAsyncEnumerable();
-            var res = xs.ToDictionary(x => x % 2).Result;
-            Assert.True(res[0] == 4);
-            Assert.True(res[1] == 1);
-        }
-
-        [Fact]
-        public void ToDictionary2()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            AssertThrows<Exception>(() => xs.ToDictionary(x => x % 2).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException);
-        }
-
-        [Fact]
-        public void ToDictionary3()
-        {
-            var xs = new[] { 1, 4 }.ToAsyncEnumerable();
-            var res = xs.ToDictionary(x => x % 2, x => x + 1).Result;
-            Assert.True(res[0] == 5);
-            Assert.True(res[1] == 2);
-        }
-
-        [Fact]
-        public void ToDictionary4()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            AssertThrows<Exception>(() => xs.ToDictionary(x => x % 2, x => x + 1).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException);
-        }
-
-        [Fact]
-        public void ToDictionary5()
-        {
-            var xs = new[] { 1, 4 }.ToAsyncEnumerable();
-            var res = xs.ToDictionary(x => x % 2, new Eq()).Result;
-            Assert.True(res[0] == 4);
-            Assert.True(res[1] == 1);
-        }
-
-        [Fact]
-        public void ToDictionary6()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            AssertThrows<Exception>(() => xs.ToDictionary(x => x % 2, new Eq()).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException);
-        }
-
-        [Fact]
-        public void ToDictionary7()
-        {
-            var xs = new[] { 1, 4 }.ToAsyncEnumerable();
-            var res = xs.ToDictionary(x => x % 2, x => x, new Eq()).Result;
-            Assert.True(res[0] == 4);
-            Assert.True(res[1] == 1);
-        }
-
-        [Fact]
-        public async Task ToLookup_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(null, x => 0));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(null, x => 0, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(AsyncEnumerable.Return(42), null, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(AsyncEnumerable.Return(42), x => 0, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(null, x => 0, x => 0));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), null, x => 0));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), x => 0, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(null, x => 0, x => 0, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), x => 0, x => 0, null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(null, x => 0, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(null, x => 0, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(AsyncEnumerable.Return(42), null, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int>(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(null, x => 0, x => 0, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), null, x => 0, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(null, x => 0, x => 0, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ToLookup<int, int, int>(AsyncEnumerable.Return(42), x => 0, x => 0, null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void ToLookup1()
-        {
-            var xs = new[] { 1, 4 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2).Result;
-            Assert.True(res.Contains(0));
-            Assert.True(res.Contains(1));
-            Assert.Contains(4, res[0]);
-            Assert.Contains(1, res[1]);
-            Assert.True(res.Count == 2);
-        }
-
-        [Fact]
-        public void ToLookup2()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2).Result;
-            Assert.True(res.Contains(0));
-            Assert.True(res.Contains(1));
-            Assert.Contains(4, res[0]);
-            Assert.Contains(2, res[0]);
-            Assert.Contains(1, res[1]);
-            Assert.True(res.Count == 2);
-        }
-
-        [Fact]
-        public void ToLookup3()
-        {
-            var xs = new[] { 1, 4 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2, x => x + 1).Result;
-            Assert.True(res.Contains(0));
-            Assert.True(res.Contains(1));
-            Assert.Contains(5, res[0]);
-            Assert.Contains(2, res[1]);
-            Assert.True(res.Count == 2);
-        }
-
-        [Fact]
-        public void ToLookup4()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2, x => x + 1).Result;
-            Assert.True(res.Contains(0));
-            Assert.True(res.Contains(1));
-            Assert.Contains(5, res[0]);
-            Assert.Contains(3, res[0]);
-            Assert.Contains(2, res[1]);
-            Assert.True(res.Count == 2);
-        }
-
-        [Fact]
-        public void ToLookup5()
-        {
-            var xs = new[] { 1, 4 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2, new Eq()).Result;
-            Assert.True(res.Contains(0));
-            Assert.True(res.Contains(1));
-            Assert.Contains(4, res[0]);
-            Assert.Contains(1, res[1]);
-            Assert.True(res.Count == 2);
-        }
-
-        [Fact]
-        public void ToLookup6()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2, new Eq()).Result;
-            Assert.True(res.Contains(0));
-            Assert.True(res.Contains(1));
-            Assert.Contains(4, res[0]);
-            Assert.Contains(2, res[0]);
-            Assert.Contains(1, res[1]);
-            Assert.True(res.Count == 2);
-        }
-
-        [Fact]
-        public void ToLookup7()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2).Result;
-            foreach (var g in res)
-            {
-                Assert.True(g.Key == 0 || g.Key == 1);
-            }
-        }
-
-        [Fact]
-        public void ToLookup8()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2).Result;
-#pragma warning disable IDE0007 // Use implicit type
-            foreach (IGrouping<int, int> g in (IEnumerable)res)
-            {
-                Assert.True(g.Key == 0 || g.Key == 1);
-            }
-#pragma warning restore IDE0007 // Use implicit type
-        }
-
-        [Fact]
-        public void ToLookup9()
-        {
-            var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable();
-            var res = xs.ToLookup(x => x % 2, x => x, new Eq()).Result;
-            Assert.True(res.Contains(0));
-            Assert.True(res.Contains(1));
-            Assert.Contains(4, res[0]);
-            Assert.Contains(2, res[0]);
-            Assert.Contains(1, res[1]);
-            Assert.True(res.Count == 2);
-        }
-
-        [Fact]
-        public async Task Average_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<int?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<long>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<long?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<double>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<double?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<float>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<float?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<decimal>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<decimal?>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<int>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<int?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<long>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<long?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<double>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<double?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<float>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<float?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<decimal>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<decimal?>), x => x));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, int?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, long>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, long?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, double>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, double?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, float>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, float?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, decimal>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, decimal?>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<int>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<int?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<long>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<long?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<double>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<double?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<float>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<float?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<decimal>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<decimal?>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<int>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<int?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<long>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<long?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<double>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<double?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<float>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<float?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<decimal>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(default(IAsyncEnumerable<decimal?>), x => x, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, int?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, long>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, long?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, double>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, double?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, float>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, float?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, decimal>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Average(AsyncEnumerable.Empty<int>(), default(Func<int, decimal?>), CancellationToken.None));
-        }
-
-        [Fact]
-        public void Average1()
-        {
-            var xs = new[] { 1, 2, 3 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average2()
-        {
-            var xs = new[] { 1, default(int?), 3 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average3()
-        {
-            var xs = new[] { 1L, 2L, 3L };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average4()
-        {
-            var xs = new[] { 1L, default(long?), 3L };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average5()
-        {
-            var xs = new[] { 1.0, 2.0, 3.0 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average6()
-        {
-            var xs = new[] { 1.0, default(double?), 3.0 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average7()
-        {
-            var xs = new[] { 1.0f, 2.0f, 3.0f };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average8()
-        {
-            var xs = new[] { 1.0f, default(float?), 3.0f };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average9()
-        {
-            var xs = new[] { 1.0m, 2.0m, 3.0m };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average10()
-        {
-            var xs = new[] { 1.0m, default(decimal?), 3.0m };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Average(), ys.Average().Result);
-            Assert.Equal(xs.Average(), ys.Average(x => x).Result);
-        }
-
-        [Fact]
-        public void Average11()
-        {
-            var xs = new int[0];
-            var ys = xs.ToAsyncEnumerable();
-            AssertThrows<Exception>(() => ys.Average().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Average12()
-        {
-            var xs = new int?[0];
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Null(ys.Average().Result);
-        }
-
-        [Fact]
-        public void Average13()
-        {
-            var xs = new long[0];
-            var ys = xs.ToAsyncEnumerable();
-            AssertThrows<Exception>(() => ys.Average().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Average14()
-        {
-            var xs = new long?[0];
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Null(ys.Average().Result);
-        }
-
-        [Fact]
-        public void Average15()
-        {
-            var xs = new double[0];
-            var ys = xs.ToAsyncEnumerable();
-            AssertThrows<Exception>(() => ys.Average().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Average16()
-        {
-            var xs = new double?[0];
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Null(ys.Average().Result);
-        }
-
-        [Fact]
-        public void Average17()
-        {
-            var xs = new float[0];
-            var ys = xs.ToAsyncEnumerable();
-            AssertThrows<Exception>(() => ys.Average().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Average18()
-        {
-            var xs = new float?[0];
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Null(ys.Average().Result);
-        }
-
-        [Fact]
-        public void Average19()
-        {
-            var xs = new decimal[0];
-            var ys = xs.ToAsyncEnumerable();
-            AssertThrows<Exception>(() => ys.Average().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void Average20()
-        {
-            var xs = new decimal?[0];
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Null(ys.Average().Result);
-        }
-
-        [Fact]
-        public async Task Min_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<int?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<long>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<long?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<double>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<double?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<float>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<float?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<decimal>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<decimal?>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<int>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<int?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<long>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<long?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<double>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<double?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<float>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<float?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<decimal>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<decimal?>), x => x));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, int?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, long>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, long?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, double>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, double?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, float>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, float?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, decimal>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, decimal?>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<DateTime>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<DateTime>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<DateTime>(), default(Func<DateTime, bool>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<int>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<int?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<long>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<long?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<double>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<double?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<float>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<float?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<decimal>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<decimal?>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<int>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<int?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<long>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<long?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<double>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<double?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<float>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<float?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<decimal>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<decimal?>), x => x, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, int>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, int?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, long>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, long?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, double>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, double?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, float>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, float?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, decimal>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<int>(), default(Func<int, decimal?>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<DateTime>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default(IAsyncEnumerable<DateTime>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<DateTime>(), default(Func<DateTime, bool>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default, Comparer<DateTime>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<DateTime>(), default(IComparer<DateTime>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(default, Comparer<DateTime>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Min(AsyncEnumerable.Empty<DateTime>(), default(IComparer<DateTime>), CancellationToken.None));
-        }
-
-        [Fact]
-        public void Min1()
-        {
-            var xs = new[] { 2, 1, 3 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min2()
-        {
-            var xs = new[] { 2, default(int?), 3 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min3()
-        {
-            var xs = new[] { 2L, 1L, 3L };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min4()
-        {
-            var xs = new[] { 2L, default(long?), 3L };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min5()
-        {
-            var xs = new[] { 2.0, 1.0, 3.0 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min6()
-        {
-            var xs = new[] { 2.0, default(double?), 3.0 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min7()
-        {
-            var xs = new[] { 2.0f, 1.0f, 3.0f };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min8()
-        {
-            var xs = new[] { 2.0f, default(float?), 3.0f };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min9()
-        {
-            var xs = new[] { 2.0m, 1.0m, 3.0m };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min10()
-        {
-            var xs = new[] { 2.0m, default(decimal?), 3.0m };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public void Min11()
-        {
-            var xs = new[] { DateTime.Now.AddDays(1), DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now.AddDays(2), DateTime.Now };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Min(), ys.Min().Result);
-            Assert.Equal(xs.Min(), ys.Min(x => x).Result);
-        }
-
-        [Fact]
-        public async Task Max_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<int?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<long>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<long?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<double>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<double?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<float>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<float?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<decimal>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<decimal?>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<int>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<int?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<long>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<long?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<double>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<double?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<float>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<float?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<decimal>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<decimal?>), x => x));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, int?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, long>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, long?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, double>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, double?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, float>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, float?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, decimal>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, decimal?>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<DateTime>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<DateTime>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<DateTime>(), default(Func<DateTime, bool>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<int>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<int?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<long>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<long?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<double>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<double?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<float>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<float?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<decimal>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<decimal?>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<int>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<int?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<long>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<long?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<double>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<double?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<float>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<float?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<decimal>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<decimal?>), x => x, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, int>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, int?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, long>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, long?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, double>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, double?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, float>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, float?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, decimal>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<int>(), default(Func<int, decimal?>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<DateTime>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default(IAsyncEnumerable<DateTime>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<DateTime>(), default(Func<DateTime, bool>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default, Comparer<DateTime>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<DateTime>(), default(IComparer<DateTime>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(default, Comparer<DateTime>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Max(AsyncEnumerable.Empty<DateTime>(), default(IComparer<DateTime>), CancellationToken.None));
-        }
-
-        [Fact]
-        public void Max1()
-        {
-            var xs = new[] { 2, 7, 3 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max2()
-        {
-            var xs = new[] { 2, default(int?), 3, 1 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max3()
-        {
-            var xs = new[] { 2L, 7L, 3L };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max4()
-        {
-            var xs = new[] { 2L, default(long?), 3L, 1L };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max5()
-        {
-            var xs = new[] { 2.0, 7.0, 3.0 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max6()
-        {
-            var xs = new[] { 2.0, default(double?), 3.0, 1.0 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max7()
-        {
-            var xs = new[] { 2.0f, 7.0f, 3.0f };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max8()
-        {
-            var xs = new[] { 2.0f, default(float?), 3.0f, 1.0f };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max9()
-        {
-            var xs = new[] { 2.0m, 7.0m, 3.0m };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max10()
-        {
-            var xs = new[] { 2.0m, default(decimal?), 3.0m, 1.0m };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public void Max11()
-        {
-            var xs = new[] { DateTime.Now.AddDays(1), DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now.AddDays(2), DateTime.Now };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Max(), ys.Max().Result);
-            Assert.Equal(xs.Max(), ys.Max(x => x).Result);
-        }
-
-        [Fact]
-        public async Task Sum_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<int?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<long>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<long?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<double>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<double?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<float>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<float?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<decimal>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<decimal?>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<int>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<int?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<long>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<long?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<double>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<double?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<float>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<float?>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<decimal>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<decimal?>), x => x));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, int?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, long>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, long?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, double>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, double?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, float>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, float?>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, decimal>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, decimal?>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<int>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<int?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<long>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<long?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<double>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<double?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<float>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<float?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<decimal>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<decimal?>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<int>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<int?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<long>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<long?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<double>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<double?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<float>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<float?>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<decimal>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(default(IAsyncEnumerable<decimal?>), x => x, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, int?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, long>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, long?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, double>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, double?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, float>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, float?>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, decimal>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty<int>(), default(Func<int, decimal?>), CancellationToken.None));
-        }
-
-        [Fact]
-        public void Sum1()
-        {
-            var xs = new[] { 1, 2, 3 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum2()
-        {
-            var xs = new[] { 1, default(int?), 3 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum3()
-        {
-            var xs = new[] { 1L, 2L, 3L };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum4()
-        {
-            var xs = new[] { 1L, default(long?), 3L };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum5()
-        {
-            var xs = new[] { 1.0, 2.0, 3.0 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum6()
-        {
-            var xs = new[] { 1.0, default(double?), 3.0 };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum7()
-        {
-            var xs = new[] { 1.0f, 2.0f, 3.0f };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum8()
-        {
-            var xs = new[] { 1.0f, default(float?), 3.0f };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum9()
-        {
-            var xs = new[] { 1.0m, 2.0m, 3.0m };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public void Sum10()
-        {
-            var xs = new[] { 1.0m, default(decimal?), 3.0m };
-            var ys = xs.ToAsyncEnumerable();
-            Assert.Equal(xs.Sum(), ys.Sum().Result);
-            Assert.Equal(xs.Sum(), ys.Sum(x => x).Result);
-        }
-
-        [Fact]
-        public async Task MinBy_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable<int>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func<int, int>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable<int>), x => x, Comparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default, Comparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), x => x, default(IComparer<int>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable<int>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func<int, int>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable<int>), x => x, Comparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default, Comparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), x => x, default, CancellationToken.None));
-        }
-
-        [Fact]
-        public void MinBy1()
-        {
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => x / 2);
-            var res = xs.Result;
-
-            Assert.True(res.SequenceEqual(new[] { 3, 2 }));
-        }
-
-        [Fact]
-        public void MinBy2()
-        {
-            var xs = new int[0].ToAsyncEnumerable().MinBy(x => x / 2);
-
-            AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void MinBy3()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => { if (x == 3) { throw ex; } return x; });
-
-            AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void MinBy4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => { if (x == 4) { throw ex; } return x; });
-
-            AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void MinBy5()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex)).MinBy(x => x, Comparer<int>.Default);
-
-            AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task MaxBy_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable<int>), x => x));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func<int, int>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable<int>), x => x, Comparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default, Comparer<int>.Default));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), x => x, default(IComparer<int>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable<int>), x => x, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func<int, int>), CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable<int>), x => x, Comparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default, Comparer<int>.Default, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), x => x, default, CancellationToken.None));
-        }
-
-        [Fact]
-        public void MaxBy1()
-        {
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => x / 2);
-            var res = xs.Result;
-
-            Assert.True(res.SequenceEqual(new[] { 7, 6 }));
-        }
-
-        [Fact]
-        public void MaxBy2()
-        {
-            var xs = new int[0].ToAsyncEnumerable().MaxBy(x => x / 2);
-
-            AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException);
-        }
-
-        [Fact]
-        public void MaxBy3()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => { if (x == 3) { throw ex; } return x; });
-
-            AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void MaxBy4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => { if (x == 4) { throw ex; } return x; });
-
-            AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void MaxBy5()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex)).MaxBy(x => x, Comparer<int>.Default);
-
-            AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-    }
-}

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

@@ -21,81 +21,6 @@ namespace Tests
             };
         }
 
-        /*
-        [Fact]
-        public void TestPushPopAsync()
-        {
-            var stack = new Stack<int>();
-            var count = 10;
-
-            var observable = Observable.Generate(
-              0,
-              i => i < count,
-              i => i + 1,
-              i => i,
-              i => TimeSpan.FromMilliseconds(1), // change this to 0 to avoid the problem [1]
-              Scheduler.ThreadPool);
-
-            var task = DoSomethingAsync(observable, stack);
-
-            // we give it a timeout so the test can fail instead of hang
-            task.Wait(TimeSpan.FromSeconds(2));
-
-            Assert.Equal(10, stack.Count);
-        }
-
-        private Task DoSomethingAsync(IObservable<int> observable, Stack<int> stack)
-        {
-            var ae = observable
-              .ToAsyncEnumerable()
-                //.Do(i => Debug.WriteLine("Bug-fixing side effect: " + i))   // [2]
-              .GetEnumerator();
-
-            var tcs = new TaskCompletionSource<object>();
-
-            var a = default(Action);
-            a = new Action(() =>
-            {
-                ae.MoveNext().ContinueWith(t =>
-                {
-                    if (t.Result)
-                    {
-                        var i = ae.Current;
-                        Debug.WriteLine("Doing something with " + i);
-                        Thread.Sleep(50);
-                        stack.Push(i);
-                        a();
-                    }
-                    else
-                        tcs.TrySetResult(null);
-                });
-            });
-
-            a();
-
-            return tcs.Task;
-        }
-        */
-#if !NO_THREAD
-        private static IEnumerable<int> Xs(Action a)
-        {
-            try
-            {
-                var rnd = new Random();
-
-                while (true)
-                {
-                    yield return rnd.Next(0, 43);
-                    Thread.Sleep(rnd.Next(0, 500));
-                }
-            }
-            finally
-            {
-                a();
-            }
-        }
-#endif
-
         [Fact]
         public async void CorrectDispose()
         {
@@ -108,19 +33,19 @@ namespace Tests
 
             var ys = xs.Select(x => x + 1);
 
-            var e = ys.GetEnumerator();
+            var e = ys.GetAsyncEnumerator();
 
             // We have to call move next because otherwise the internal enumerator is never allocated
-            await e.MoveNext();
-            e.Dispose();
+            await e.MoveNextAsync();
+            await e.DisposeAsync();
 
             await disposed.Task;
 
-            Assert.True(disposed.Task.Result);
+            Assert.True(await disposed.Task);
 
-            Assert.False(e.MoveNext().Result);
+            Assert.False(await e.MoveNextAsync());
 
-            var next = await e.MoveNext();
+            var next = await e.MoveNextAsync();
             Assert.False(next);
         }
 
@@ -135,251 +60,47 @@ namespace Tests
             }).ToAsyncEnumerable();
 
             var ex = new Exception("Bang!");
-            var ys = xs.Select(x => { if (x == 1) { throw ex; } return x; });
+            var ys = xs.Select(x => { if (x == 1) throw ex; return x; });
 
-            var e = ys.GetEnumerator();
-            await Assert.ThrowsAsync<Exception>(() => e.MoveNext());
+            var e = ys.GetAsyncEnumerator();
+            await AssertX.ThrowsAsync<Exception>(() => e.MoveNextAsync());
 
             var result = await disposed.Task;
             Assert.True(result);
         }
 
-        [Fact]
-        public async Task CorrectCancel()
-        {
-            var disposed = new TaskCompletionSource<bool>();
-
-            var xs = new CancellationTestAsyncEnumerable().WithDispose(() =>
-            {
-                disposed.TrySetResult(true);
-            });
-
-            var ys = xs.Select(x => x + 1).Where(x => true);
-
-            var e = ys.GetEnumerator();
-            var cts = new CancellationTokenSource();
-            var t = e.MoveNext(cts.Token);
-
-            cts.Cancel();
-
-            try
-            {
-                t.Wait(WaitTimeoutMs);
-            }
-            catch
-            {
-                // Don't care about the outcome; we could have made it to element 1
-                // but we could also have cancelled the MoveNext-calling task. Either
-                // way, we want to wait for the task to be completed and check that
-            }
-            finally
-            {
-                // the cancellation bubbled all the way up to the source to dispose
-                // it. This design is chosen because cancelling a MoveNext call leaves
-                // the enumerator in an indeterminate state. Further interactions with
-                // it should be forbidden.
-
-                var result = await disposed.Task;
-                Assert.True(result);
-            }
-
-            Assert.False(await e.MoveNext());
-        }
-
-        [Fact]
-        public void CanCancelMoveNext()
-        {
-            var xs = new CancellationTestAsyncEnumerable().Select(x => x).Where(x => true);
-
-            var e = xs.GetEnumerator();
-            var cts = new CancellationTokenSource();
-            var t = e.MoveNext(cts.Token);
-
-            cts.Cancel();
-
-            try
-            {
-                t.Wait(WaitTimeoutMs);
-                Assert.True(false);
-            }
-            catch
-            {
-                Assert.True(t.IsCanceled);
-            }
-        }
-
-        /// <summary>
-        /// Waits WaitTimeoutMs or until cancellation is requested. If cancellation was not requested, MoveNext returns true.
-        /// </summary>
-        internal sealed class CancellationTestAsyncEnumerable : IAsyncEnumerable<int>
-        {
-            private readonly int _iterationsBeforeDelay;
-
-            public CancellationTestAsyncEnumerable(int iterationsBeforeDelay = 0)
-            {
-                _iterationsBeforeDelay = iterationsBeforeDelay;
-            }
-            IAsyncEnumerator<int> IAsyncEnumerable<int>.GetEnumerator() => GetEnumerator();
-
-            public TestEnumerator GetEnumerator() => new TestEnumerator(_iterationsBeforeDelay);
-
-
-            internal sealed class TestEnumerator : IAsyncEnumerator<int>
-            {
-                private readonly int _iterationsBeforeDelay;
-
-                public TestEnumerator(int iterationsBeforeDelay)
-                {
-                    _iterationsBeforeDelay = iterationsBeforeDelay;
-                }
-
-                private int _i = -1;
-                public void Dispose()
-                {
-                }
-
-                public CancellationToken LastToken { get; private set; }
-                public bool MoveNextWasCalled { get; private set; }
-
-                public int Current => _i;
-
-                public async Task<bool> MoveNext(CancellationToken cancellationToken)
-                {
-                    LastToken = cancellationToken;
-                    MoveNextWasCalled = true;
-
-                    _i++;
-                    if (Current >= _iterationsBeforeDelay)
-                    {
-                        await Task.Delay(WaitTimeoutMs, cancellationToken);
-                    }
-                    cancellationToken.ThrowIfCancellationRequested();
-                    return true;
-                }
-            }
-        }
-
-        /// <summary>
-        /// Waits WaitTimeoutMs or until cancellation is requested. If cancellation was not requested, MoveNext returns true.
-        /// </summary>
-        private sealed class CancellationTestEnumerable<T> : IEnumerable<T>
-        {
-            public CancellationTestEnumerable()
-            {
-            }
-            public IEnumerator<T> GetEnumerator() => new TestEnumerator();
-
-            private sealed class TestEnumerator : IEnumerator<T>
-            {
-                private readonly CancellationTokenSource _cancellationTokenSource;
-
-                public TestEnumerator()
-                {
-                    _cancellationTokenSource = new CancellationTokenSource();
-                }
-                public void Dispose()
-                {
-                    _cancellationTokenSource.Cancel();
-                }
-
-                public void Reset()
-                {
-
-                }
-
-                object IEnumerator.Current => Current;
-
-                public T Current { get; }
-
-                public bool MoveNext()
-                {
-                    Task.Delay(WaitTimeoutMs, _cancellationTokenSource.Token).Wait();
-                    _cancellationTokenSource.Token.ThrowIfCancellationRequested();
-                    return true;
-                }
-            }
-
-            IEnumerator IEnumerable.GetEnumerator()
-            {
-                return GetEnumerator();
-            }
-        }
-
-        [Fact]
-        public void ToAsyncEnumeratorCannotCancelOnceRunning()
-        {
-            var evt = new ManualResetEvent(false);
-            var isRunningEvent = new ManualResetEvent(false);
-            var xs = Blocking(evt, isRunningEvent).ToAsyncEnumerable();
-
-            var e = xs.GetEnumerator();
-            var cts = new CancellationTokenSource();
-
-
-            Task<bool> t = null;
-            var tMoveNext = Task.Run(
-                () =>
-                {
-                    // This call *will* block
-                    t = e.MoveNext(cts.Token);
-                });
-
-
-            isRunningEvent.WaitOne();
-            cts.Cancel();
-
-            try
-            {
-                tMoveNext.Wait(0);
-                Assert.False(t.IsCanceled);
-            }
-            catch
-            {
-                // T will still be null
-                Assert.Null(t);
-            }
-
-
-            // enable it to finish
-            evt.Set();
-        }
-
-        private static IEnumerable<int> Blocking(ManualResetEvent evt, ManualResetEvent blockingStarted)
-        {
-            blockingStarted.Set();
-            evt.WaitOne();
-            yield return 42;
-        }
-
         [Fact]
         public async Task TakeOneFromSelectMany()
         {
-            var enumerable = AsyncEnumerable
-                .Return(0)
-                .SelectMany(_ => AsyncEnumerable.Return("Check"))
+            var ret0 = new[] { 0 }.ToAsyncEnumerable();
+            var retCheck = new[] { "Check" }.ToAsyncEnumerable();
+
+            var enumerable =
+                ret0
+                .SelectMany(_ => retCheck)
                 .Take(1)
                 .Do(_ => { });
 
-            Assert.Equal("Check", await enumerable.First());
+            Assert.Equal("Check", await enumerable.FirstAsync());
         }
 
         [Fact]
-        public void SelectManyDisposeInvokedOnlyOnce()
+        public async Task SelectManyDisposeInvokedOnlyOnceAsync()
         {
             var disposeCounter = new DisposeCounter();
 
-            var result = AsyncEnumerable.Return(1).SelectMany(i => disposeCounter).Select(i => i).ToList().Result;
+            var result = await new[] { 1 }.ToAsyncEnumerable().SelectMany(i => disposeCounter).Select(i => i).ToListAsync();
 
             Assert.Empty(result);
             Assert.Equal(1, disposeCounter.DisposeCount);
         }
 
         [Fact]
-        public void SelectManyInnerDispose()
+        public async Task SelectManyInnerDisposeAsync()
         {
             var disposes = Enumerable.Range(0, 10).Select(_ => new DisposeCounter()).ToList();
 
-            var result = AsyncEnumerable.Range(0, 10).SelectMany(i => disposes[i]).Select(i => i).ToList().Result;
+            var result = await AsyncEnumerable.Range(0, 10).SelectMany(i => disposes[i]).Select(i => i).ToListAsync();
 
             Assert.Empty(result);
             Assert.True(disposes.All(d => d.DisposeCount == 1));
@@ -388,7 +109,7 @@ namespace Tests
         [Fact]
         public void DisposeAfterCreation()
         {
-            var enumerable = AsyncEnumerable.Return(0) as IDisposable;
+            var enumerable = new[] { 1 }.ToAsyncEnumerable() as IDisposable;
             enumerable?.Dispose();
         }
 
@@ -396,7 +117,7 @@ namespace Tests
         {
             public int DisposeCount { get; private set; }
 
-            public IAsyncEnumerator<object> GetEnumerator()
+            public IAsyncEnumerator<object> GetAsyncEnumerator(CancellationToken cancellationToken)
             {
                 return new Enumerator(this);
             }
@@ -410,14 +131,15 @@ namespace Tests
                     _disposeCounter = disposeCounter;
                 }
 
-                public void Dispose()
+                public ValueTask DisposeAsync()
                 {
                     _disposeCounter.DisposeCount++;
+                    return default;
                 }
 
-                public Task<bool> MoveNext(CancellationToken _)
+                public ValueTask<bool> MoveNextAsync()
                 {
-                    return Task.Factory.StartNew(() => false);
+                    return new ValueTask<bool>(Task.Factory.StartNew(() => false));
                 }
 
                 public object Current { get; private set; }
@@ -429,23 +151,28 @@ namespace Tests
     {
         public static IEnumerable<T> WithDispose<T>(this IEnumerable<T> source, Action a)
         {
-            return EnumerableEx.Create(() =>
+            return new Enumerable<T>(() =>
             {
                 var e = source.GetEnumerator();
                 return new Enumerator<T>(e.MoveNext, () => e.Current, () => { e.Dispose(); a(); });
             });
         }
 
-        public static IAsyncEnumerable<T> WithDispose<T>(this IAsyncEnumerable<T> source, Action a)
+        private sealed class Enumerable<T> : IEnumerable<T>
         {
-            return AsyncEnumerable.CreateEnumerable<T>(() =>
+            private readonly Func<IEnumerator<T>> _getEnumerator;
+
+            public Enumerable(Func<IEnumerator<T>> getEnumerator)
             {
-                var e = source.GetEnumerator();
-                return AsyncEnumerable.CreateEnumerator<T>(e.MoveNext, () => e.Current, () => { e.Dispose(); a(); });
-            });
+                _getEnumerator = getEnumerator;
+            }
+
+            public IEnumerator<T> GetEnumerator() => _getEnumerator();
+
+            IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
         }
 
-        private class Enumerator<T> : IEnumerator<T>
+        private sealed class Enumerator<T> : IEnumerator<T>
         {
             private readonly Func<bool> _moveNext;
             private readonly Func<T> _current;
@@ -458,31 +185,18 @@ namespace Tests
                 _dispose = dispose;
             }
 
-            public T Current
-            {
-                get { return _current(); }
-            }
+            public T Current => _current();
 
-            public void Dispose()
-            {
-                _dispose();
-            }
+            public void Dispose() => _dispose();
 
-            object IEnumerator.Current
-            {
-                get { return Current; }
-            }
+            object IEnumerator.Current => Current;
 
-            public bool MoveNext()
-            {
-                return _moveNext();
-            }
+            public bool MoveNext() => _moveNext();
 
             public void Reset()
             {
                 throw new NotImplementedException();
             }
         }
-
     }
 }

+ 0 - 591
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Conversions.cs

@@ -1,591 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace Tests
-{
-    public partial class AsyncTests
-    {
-        [Fact]
-        public void ToAsyncEnumerable_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ToAsyncEnumerable<int>(default(IEnumerable<int>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ToAsyncEnumerable<int>(default(IObservable<int>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ToAsyncEnumerable<int>(default(Task<int>)));
-        }
-
-        [Fact]
-        public void ToAsyncEnumerable1()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void ToAsyncEnumerable2()
-        {
-            var ex = new Exception("Bang");
-            var xs = ToAsyncEnumerable_Sequence(ex).ToAsyncEnumerable();
-            var e = xs.GetEnumerator();
-            HasNext(e, 42);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex);
-        }
-
-        private IEnumerable<int> ToAsyncEnumerable_Sequence(Exception e)
-        {
-            yield return 42;
-            throw e;
-        }
-
-        [Fact]
-        public void ToAsyncEnumerable3()
-        {
-            var subscribed = false;
-
-            var xs = new MyObservable<int>(obs =>
-            {
-                subscribed = true;
-
-                obs.OnNext(42);
-                obs.OnCompleted();
-
-                return new MyDisposable(() => { });
-            }).ToAsyncEnumerable();
-
-            Assert.False(subscribed);
-
-            var e = xs.GetEnumerator();
-
-            Assert.True(subscribed);
-
-            HasNext(e, 42);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void ToAsyncEnumerable4()
-        {
-            var ex = new Exception("Bang!");
-            var subscribed = false;
-
-            var xs = new MyObservable<int>(obs =>
-            {
-                subscribed = true;
-
-                obs.OnError(ex);
-
-                return new MyDisposable(() => { });
-            }).ToAsyncEnumerable();
-
-            Assert.False(subscribed);
-
-            var e = xs.GetEnumerator();
-
-            Assert.True(subscribed);
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ToAsyncEnumerable5()
-        {
-            var set = new HashSet<int>(new[] { 1, 2, 3, 4 });
-
-            var xs = set.ToAsyncEnumerable();
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task ToAsyncEnumerable6()
-        {
-            var set = new HashSet<int>(new[] { 1, 2, 3, 4, 5, 6, 7, 8 });
-
-            var xs = set.ToAsyncEnumerable();
-
-            var arr = await xs.ToArray();
-
-            Assert.True(set.SetEquals(arr));
-        }
-
-        [Fact]
-        public async Task ToAsyncEnumerable7()
-        {
-            var set = new HashSet<int>(new[] { 1, 2, 3, 4 });
-            var xs = set.ToAsyncEnumerable();
-
-            var arr = await xs.ToList();
-
-            Assert.True(set.SetEquals(arr));
-        }
-
-        [Fact]
-        public async Task ToAsyncEnumerable8()
-        {
-            var set = new HashSet<int>(new[] { 1, 2, 3, 4 });
-            var xs = set.ToAsyncEnumerable();
-
-            var c = await xs.Count();
-
-            Assert.Equal(set.Count, c);
-        }
-
-        [Fact]
-        public async Task ToAsyncEnumerable9()
-        {
-            var set = new HashSet<int>(new[] { 1, 2, 3, 4 });
-            var xs = set.ToAsyncEnumerable();
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public async Task ToAsyncEnumerable10()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void ToAsyncEnumerabl11()
-        {
-            var set = new HashSet<int>(new[] { 1, 2, 3, 4 });
-            var xs = set.ToAsyncEnumerable();
-
-            var xc = xs as ICollection<int>;
-
-            Assert.NotNull(xc);
-
-            Assert.False(xc.IsReadOnly);
-
-            xc.Add(5);
-
-
-            Assert.True(xc.Contains(5));
-
-            Assert.True(xc.Remove(5));
-
-            var arr = new int[4];
-            xc.CopyTo(arr, 0);
-            Assert.True(arr.SequenceEqual(xc));
-            xc.Clear();
-            Assert.Equal(0, xc.Count);
-        }
-
-        [Fact]
-        public void ToAsyncEnumerabl12()
-        {
-            var set = new List<int> { 1, 2, 3, 4 };
-            var xs = set.ToAsyncEnumerable();
-
-            var xl = xs as IList<int>;
-
-            Assert.NotNull(xl);
-
-            Assert.False(xl.IsReadOnly);
-
-            xl.Add(5);
-
-
-            Assert.True(xl.Contains(5));
-
-            Assert.True(xl.Remove(5));
-
-            xl.Insert(2, 10);
-
-            Assert.Equal(2, xl.IndexOf(10));
-            xl.RemoveAt(2);
-
-            xl[0] = 7;
-            Assert.Equal(7, xl[0]);
-
-            var arr = new int[4];
-            xl.CopyTo(arr, 0);
-            Assert.True(arr.SequenceEqual(xl));
-            xl.Clear();
-            Assert.Equal(0, xl.Count);
-
-        }
-
-        [Fact]
-        public void ToAsyncEnumerable_With_Completed_Task()
-        {
-            var task = Task.Factory.StartNew(() => 36);
-
-            var xs = task.ToAsyncEnumerable();
-            var e = xs.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            Assert.Equal(36, e.Current);
-            Assert.False(e.MoveNext().Result);
-        }
-
-        [Fact]
-        public void ToAsyncEnumerable_With_Faulted_Task()
-        {
-            var ex = new InvalidOperationException();
-            var tcs = new TaskCompletionSource<int>();
-            tcs.SetException(ex);
-
-            var xs = tcs.Task.ToAsyncEnumerable();
-            var e = xs.GetEnumerator();
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ToAsyncEnumerable_With_Canceled_Task()
-        {
-            var tcs = new TaskCompletionSource<int>();
-            tcs.SetCanceled();
-
-            var xs = tcs.Task.ToAsyncEnumerable();
-            var e = xs.GetEnumerator();
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).InnerExceptions.Single() is TaskCanceledException);
-        }
-
-        private class MyObservable<T> : IObservable<T>
-        {
-            private readonly Func<IObserver<T>, IDisposable> _subscribe;
-
-            public MyObservable(Func<IObserver<T>, IDisposable> subscribe)
-            {
-                _subscribe = subscribe;
-            }
-
-            public IDisposable Subscribe(IObserver<T> observer)
-            {
-                return _subscribe(observer);
-            }
-        }
-
-        private class MyDisposable : IDisposable
-        {
-            private readonly Action _dispose;
-
-            public MyDisposable(Action dispose)
-            {
-                _dispose = dispose;
-            }
-
-            public void Dispose()
-            {
-                _dispose();
-            }
-        }
-
-        [Fact]
-        public void ToEnumerable_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ToEnumerable<int>(null));
-        }
-
-        [Fact]
-        public void ToEnumerable1()
-        {
-            var xs = AsyncEnumerable.Return(42).ToEnumerable();
-            Assert.True(xs.SequenceEqual(new[] { 42 }));
-        }
-
-        [Fact]
-        public void ToEnumerable2()
-        {
-            var xs = AsyncEnumerable.Empty<int>().ToEnumerable();
-            Assert.True(xs.SequenceEqual(new int[0]));
-        }
-
-        [Fact]
-        public void ToEnumerable3()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex).ToEnumerable();
-            AssertThrows<Exception>(() => xs.GetEnumerator().MoveNext(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ToObservable_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ToObservable<int>(null));
-        }
-
-        [Fact]
-        public void ToObservable1()
-        {
-            var fail = false;
-            var evt = new ManualResetEvent(false);
-
-            var xs = AsyncEnumerable.Empty<int>().ToObservable();
-            xs.Subscribe(new MyObserver<int>(
-                x =>
-                {
-                    fail = true;
-                },
-                ex =>
-                {
-                    fail = true;
-                    evt.Set();
-                },
-                () =>
-                {
-                    evt.Set();
-                }
-            ));
-
-            evt.WaitOne();
-            Assert.False(fail);
-        }
-
-        [Fact]
-        public void ToObservable2()
-        {
-            var lst = new List<int>();
-            var fail = false;
-            var evt = new ManualResetEvent(false);
-
-            var xs = AsyncEnumerable.Return(42).ToObservable();
-            xs.Subscribe(new MyObserver<int>(
-                x =>
-                {
-                    lst.Add(x);
-                },
-                ex =>
-                {
-                    fail = true;
-                    evt.Set();
-                },
-                () =>
-                {
-                    evt.Set();
-                }
-            ));
-
-            evt.WaitOne();
-            Assert.False(fail);
-            Assert.True(lst.SequenceEqual(new[] { 42 }));
-        }
-
-        [Fact]
-        public void ToObservable3()
-        {
-            var lst = new List<int>();
-            var fail = false;
-            var evt = new ManualResetEvent(false);
-
-            var xs = AsyncEnumerable.Range(0, 10).ToObservable();
-            xs.Subscribe(new MyObserver<int>(
-                x =>
-                {
-                    lst.Add(x);
-                },
-                ex =>
-                {
-                    fail = true;
-                    evt.Set();
-                },
-                () =>
-                {
-                    evt.Set();
-                }
-            ));
-
-            evt.WaitOne();
-            Assert.False(fail);
-            Assert.True(lst.SequenceEqual(Enumerable.Range(0, 10)));
-        }
-
-        [Fact]
-        public void ToObservable4()
-        {
-            var ex1 = new Exception("Bang!");
-            var ex_ = default(Exception);
-            var fail = false;
-            var evt = new ManualResetEvent(false);
-
-            var xs = AsyncEnumerable.Throw<int>(ex1).ToObservable();
-            xs.Subscribe(new MyObserver<int>(
-                x =>
-                {
-                    fail = true;
-                },
-                ex =>
-                {
-                    ex_ = ex;
-                    evt.Set();
-                },
-                () =>
-                {
-                    fail = true;
-                    evt.Set();
-                }
-            ));
-
-            evt.WaitOne();
-            Assert.False(fail);
-            Assert.Equal(ex1, ((AggregateException)ex_).InnerExceptions.Single());
-        }
-
-        [Fact]
-        public void ToObservable_disposes_enumerator_on_completion()
-        {
-            var fail = false;
-            var evt = new ManualResetEvent(false);
-
-            var ae = AsyncEnumerable.CreateEnumerable(
-                () => AsyncEnumerable.CreateEnumerator<int>(
-                    ct => Task.FromResult(false),
-                    () => { throw new InvalidOperationException(); },
-                    () => { evt.Set(); }));
-
-            ae
-                .ToObservable()
-                .Subscribe(new MyObserver<int>(
-                    x =>
-                    {
-                        fail = true;
-                    },
-                    ex =>
-                    {
-                        fail = true;
-                    },
-                    () =>
-                    {
-                    }
-                ));
-
-            evt.WaitOne();
-            Assert.False(fail);
-        }
-
-        [Fact]
-        public void ToObservable_disposes_enumerator_when_subscription_is_disposed()
-        {
-            var fail = false;
-            var evt = new ManualResetEvent(false);
-            var subscription = default(IDisposable);
-            var subscriptionAssignedTcs = new TaskCompletionSource<object>();
-
-            var ae = AsyncEnumerable.CreateEnumerable(
-                () => AsyncEnumerable.CreateEnumerator(
-                    async ct =>
-                    {
-                        await subscriptionAssignedTcs.Task;
-                        return true;
-                    },
-                    () => 1,
-                    () => { evt.Set(); }));
-
-            subscription = ae
-                .ToObservable()
-                .Subscribe(new MyObserver<int>(
-                    x =>
-                    {
-                        subscription.Dispose();
-                    },
-                    ex =>
-                    {
-                        fail = true;
-                    },
-                    () =>
-                    {
-                        fail = true;
-                    }
-                ));
-
-            subscriptionAssignedTcs.SetResult(null);
-            evt.WaitOne();
-
-            Assert.False(fail);
-        }
-
-        [Fact]
-        public void ToObservable_does_not_call_MoveNext_again_when_subscription_is_disposed()
-        {
-            var fail = false;
-            var moveNextCount = 0;
-            var evt = new ManualResetEvent(false);
-            var subscription = default(IDisposable);
-            var subscriptionAssignedTcs = new TaskCompletionSource<object>();
-
-            var ae = AsyncEnumerable.CreateEnumerable(
-                () => AsyncEnumerable.CreateEnumerator(
-                    async ct =>
-                    {
-                        await subscriptionAssignedTcs.Task;
-
-                        moveNextCount++;
-                        return true;
-                    },
-                    () => 1,
-                    () => { evt.Set(); }));
-
-            subscription = ae
-                .ToObservable()
-                .Subscribe(new MyObserver<int>(
-                    x =>
-                    {
-                        subscription.Dispose();
-                    },
-                    ex =>
-                    {
-                        fail = true;
-                    },
-                    () =>
-                    {
-                        fail = true;
-                    }
-                ));
-
-            subscriptionAssignedTcs.SetResult(null);
-            evt.WaitOne();
-
-            Assert.Equal(1, moveNextCount);
-            Assert.False(fail);
-        }
-
-        private class MyObserver<T> : IObserver<T>
-        {
-            private readonly Action<T> _onNext;
-            private readonly Action<Exception> _onError;
-            private readonly Action _onCompleted;
-
-            public MyObserver(Action<T> onNext, Action<Exception> onError, Action onCompleted)
-            {
-                _onNext = onNext;
-                _onError = onError;
-                _onCompleted = onCompleted;
-            }
-
-            public void OnCompleted()
-            {
-                _onCompleted();
-            }
-
-            public void OnError(Exception error)
-            {
-                _onError(error);
-            }
-
-            public void OnNext(T value)
-            {
-                _onNext(value);
-            }
-        }
-    }
-}

+ 0 - 491
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Creation.cs

@@ -1,491 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace Tests
-{
-    public partial class AsyncTests
-    {
-
-        [Fact]
-        public void Create_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.CreateEnumerable<int>(null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.CreateEnumerator<int>(null, () => 3, () => { }));
-
-        }
-
-        [Fact]
-        public void Create_Iterator_Throws()
-        {
-
-            var iter = AsyncEnumerable.CreateEnumerator<int>(c => Task.FromResult(true), () => 3, () => { });
-
-            var enu = (IAsyncEnumerable<int>)iter;
-
-            AssertThrows<NotSupportedException>(() => enu.GetEnumerator());
-        }
-
-
-        [Fact]
-        public void Return()
-        {
-            var xs = AsyncEnumerable.Return(42);
-            HasNext(xs.GetEnumerator(), 42);
-        }
-
-        [Fact]
-        public void Never()
-        {
-            var xs = AsyncEnumerable.Never<int>();
-
-            var e = xs.GetEnumerator();
-            Assert.False(e.MoveNext().IsCompleted); // Very rudimentary check
-            AssertThrows<InvalidOperationException>(() => Nop(e.Current));
-            e.Dispose();
-        }
-
-        [Fact]
-        public async Task Empty_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.IsEmpty<int>(null));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.IsEmpty<int>(null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void Empty1()
-        {
-            var xs = AsyncEnumerable.Empty<int>();
-            NoNext(xs.GetEnumerator());
-        }
-
-        [Fact]
-        public void Empty2()
-        {
-            var xs = AsyncEnumerable.Empty<int>();
-
-            var e = xs.GetEnumerator();
-            Assert.False(e.MoveNext().Result);
-            AssertThrows<InvalidOperationException>(() => Nop(e.Current));
-        }
-
-        [Fact]
-        public void Throw_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Throw<int>(null));
-        }
-
-        [Fact]
-        public void Throw()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex);
-            AssertThrows<InvalidOperationException>(() => Nop(e.Current));
-        }
-
-        private void Nop(object o)
-        {
-        }
-
-        [Fact]
-        public void Range_Null()
-        {
-            AssertThrows<ArgumentOutOfRangeException>(() => AsyncEnumerable.Range(0, -1));
-        }
-
-        [Fact]
-        public void Range1()
-        {
-            var xs = AsyncEnumerable.Range(2, 5);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Range2()
-        {
-            var xs = AsyncEnumerable.Range(2, 0);
-
-            var e = xs.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Repeat_Null()
-        {
-            AssertThrows<ArgumentOutOfRangeException>(() => AsyncEnumerable.Repeat(0, -1));
-        }
-
-        [Fact]
-        public void Repeat1()
-        {
-            var xs = AsyncEnumerable.Repeat(2, 5);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 2);
-            HasNext(e, 2);
-            HasNext(e, 2);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Repeat2()
-        {
-            var xs = AsyncEnumerable.Repeat(2, 0);
-
-            var e = xs.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Repeat3()
-        {
-            var xs = AsyncEnumerable.Repeat(2);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 2);
-            HasNext(e, 2);
-            HasNext(e, 2);
-            HasNext(e, 2);
-            e.Dispose();
-        }
-
-        [Fact]
-        public async Task Repeat4()
-        {
-            var xs = AsyncEnumerable.Repeat(2).Take(5);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void Defer_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Defer<int>(null));
-        }
-
-        [Fact]
-        public void Defer1()
-        {
-            var x = 0;
-            var xs = AsyncEnumerable.Defer<int>(() => new[] { x }.ToAsyncEnumerable());
-
-            {
-                var e = xs.GetEnumerator();
-                HasNext(e, 0);
-                NoNext(e);
-            }
-
-            {
-                x++;
-                var e = xs.GetEnumerator();
-                HasNext(e, 1);
-                NoNext(e);
-            }
-        }
-
-        [Fact]
-        public void Generate_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Generate<int, int>(0, null, x => x, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Generate<int, int>(0, x => true, null, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Generate<int, int>(0, x => true, x => x, null));
-        }
-
-        [Fact]
-        public void Generate1()
-        {
-            var xs = AsyncEnumerable.Generate(0, x => x < 5, x => x + 1, x => x * x);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 1);
-            HasNext(e, 4);
-            HasNext(e, 9);
-            HasNext(e, 16);
-            NoNext(e);
-            e.Dispose();
-        }
-
-        [Fact]
-        public void Generate2()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Generate(0, x => { throw ex; }, x => x + 1, x => x * x);
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Generate3()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Generate(0, x => true, x => x + 1, x => { if (x == 1) { throw ex; } return x * x; });
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 0);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Generate4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Generate(0, x => true, x => { throw ex; }, x => x * x);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 0);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Generate5()
-        {
-            var xs = AsyncEnumerable.Generate(0, x => x < 5, x => x + 1, x => x * x);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void Using_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Using<int, IDisposable>(null, _ => null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Using<int, IDisposable>(() => new MyD(null), null));
-        }
-
-        [Fact]
-        public void Using1()
-        {
-            var i = 0;
-            var d = 0;
-
-            var xs = AsyncEnumerable.Using(
-                () =>
-                {
-                    i++;
-                    return new MyD(() => { d++; });
-                },
-                _ => AsyncEnumerable.Return(42)
-            );
-
-            Assert.Equal(0, i);
-
-            var e = xs.GetEnumerator();
-            Assert.Equal(1, i);
-        }
-
-        [Fact]
-        public void Using2()
-        {
-            var i = 0;
-            var d = 0;
-
-            var xs = AsyncEnumerable.Using(
-                () =>
-                {
-                    i++;
-                    return new MyD(() => { d++; });
-                },
-                _ => AsyncEnumerable.Return(42)
-            );
-
-            Assert.Equal(0, i);
-
-            var e = xs.GetEnumerator();
-            Assert.Equal(1, i);
-
-            e.Dispose();
-            Assert.Equal(1, d);
-        }
-
-        [Fact]
-        public void Using3()
-        {
-            var ex = new Exception("Bang!");
-            var i = 0;
-            var d = 0;
-
-            var xs = AsyncEnumerable.Using<int, MyD>(
-                () =>
-                {
-                    i++;
-                    return new MyD(() => { d++; });
-                },
-                _ => { throw ex; }
-            );
-
-            Assert.Equal(0, i);
-
-            AssertThrows<Exception>(() => xs.GetEnumerator(), ex_ => ex_ == ex);
-
-            Assert.Equal(1, d);
-        }
-
-        [Fact]
-        public void Using4()
-        {
-            var i = 0;
-            var disposed = new TaskCompletionSource<bool>();
-
-            var xs = AsyncEnumerable.Using(
-                () =>
-                {
-                    i++;
-                    return new MyD(() => { disposed.TrySetResult(true); });
-                },
-                _ => AsyncEnumerable.Return(42)
-            );
-
-            Assert.Equal(0, i);
-
-            var e = xs.GetEnumerator();
-            Assert.Equal(1, i);
-
-            HasNext(e, 42);
-            NoNext(e);
-
-            Assert.True(disposed.Task.Result);
-        }
-
-        [Fact]
-        public void Using5()
-        {
-            var ex = new Exception("Bang!");
-            var i = 0;
-            var disposed = new TaskCompletionSource<bool>();
-
-            var xs = AsyncEnumerable.Using(
-                () =>
-                {
-                    i++;
-                    return new MyD(() => { disposed.TrySetResult(true); });
-                },
-                _ => AsyncEnumerable.Throw<int>(ex)
-            );
-
-            Assert.Equal(0, i);
-
-            var e = xs.GetEnumerator();
-            Assert.Equal(1, i);
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-
-            Assert.True(disposed.Task.Result);
-        }
-
-        [Fact]
-        public async Task Using6()
-        {
-            var i = 0;
-            var disposed = new TaskCompletionSource<bool>();
-
-            var xs = AsyncEnumerable.Using(
-                () =>
-                {
-                    i++;
-                    return new MyD(() => { disposed.TrySetResult(true); });
-                },
-                _ => new CancellationTestAsyncEnumerable(2) // need to use this to verify we actually cancel
-            );
-
-            Assert.Equal(0, i);
-
-            var e = xs.GetEnumerator();
-            Assert.Equal(1, i);
-
-            HasNext(e, 0);
-            HasNext(e, 1);
-
-            var cts = new CancellationTokenSource();
-            var t = e.MoveNext(cts.Token);
-            cts.Cancel();
-
-            try
-            {
-                t.Wait(WaitTimeoutMs);
-            }
-            catch (AggregateException ex)
-            {
-                ex.Flatten().Handle(inner => inner is TaskCanceledException);
-            }
-
-            Assert.True(disposed.Task.IsCompleted);
-            Assert.True(await disposed.Task);
-        }
-
-        [Fact]
-        public async Task Using7()
-        {
-            var i = 0;
-            var d = 0;
-
-            var xs = AsyncEnumerable.Using(
-                () =>
-                {
-                    i++;
-                    return new MyD(() => { d++; });
-                },
-                _ => AsyncEnumerable.Return(42)
-            );
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public async Task CreateEnumerator_DisposeOnce()
-        {
-            var count = 0;
-            var dispose = 0;
-
-            var en = AsyncEnumerable.CreateEnumerable(() =>
-                AsyncEnumerable.CreateEnumerator(async ct =>
-                {
-                    await Task.Delay(0);
-                    return ++count < 3;
-                }
-                , () => 1,
-                () => dispose++
-            ));
-
-            Assert.Equal(1, await en.Last());
-
-            Assert.Equal(3, count);
-            Assert.Equal(1, dispose);
-        }
-
-        private class MyD : IDisposable
-        {
-            private readonly Action _dispose;
-
-            public MyD(Action dispose)
-            {
-                _dispose = dispose;
-            }
-
-            public void Dispose()
-            {
-                _dispose();
-            }
-        }
-    }
-}

+ 0 - 608
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Exceptions.cs

@@ -1,608 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace Tests
-{
-    public partial class AsyncTests
-    {
-        [Fact]
-        public void Catch_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Catch<int, Exception>(default, x => null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Catch<int, Exception>(AsyncEnumerable.Return(42), default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Catch<int>(default, AsyncEnumerable.Return(42)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Catch<int>(AsyncEnumerable.Return(42), default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Catch<int>(default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Catch<int>(default(IEnumerable<IAsyncEnumerable<int>>)));
-        }
-
-        [Fact]
-        public void Catch1()
-        {
-            var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = xs.Catch<int, Exception>(ex_ => { err = true; return ys; });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            NoNext(e);
-
-            Assert.False(err);
-        }
-
-        [Fact]
-        public void Catch2()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return ys; });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            Assert.False(err);
-
-            HasNext(e, 4);
-
-            Assert.True(err);
-
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Catch3()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = xs.Catch<int, Exception>(ex_ => { err = true; return ys; });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            Assert.False(err);
-
-            HasNext(e, 4);
-
-            Assert.True(err);
-
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Catch4()
-        {
-            var ex = new DivideByZeroException();
-
-            var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return ys; });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-
-            Assert.False(err);
-        }
-
-        [Fact]
-        public void Catch5()
-        {
-            var ex = new InvalidOperationException("Bang!");
-            var ex2 = new Exception("Oops!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = xs.Catch<int, InvalidOperationException>(ex_ => { if (ex_.Message == "Bang!") { throw ex2; } return ys; });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex2);
-        }
-
-        [Fact]
-        public void Catch6()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-
-            var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return xs; });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            Assert.False(err);
-
-            HasNext(e, 1);
-
-            Assert.True(err);
-
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Catch7()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.Catch(xs, ys);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Catch8()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.Catch(xs, ys);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Catch9()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.Catch(new[] { xs, xs, ys, ys });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Catch10()
-        {
-            var res = CatchXss().Catch();
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!");
-        }
-
-        private IEnumerable<IAsyncEnumerable<int>> CatchXss()
-        {
-            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(new Exception("!!!")));
-            throw new Exception("Bang!");
-        }
-
-        [Fact]
-        public void Catch11()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-
-            var res = AsyncEnumerable.Catch(new[] { xs, xs });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Catch12()
-        {
-            var res = AsyncEnumerable.Catch(Enumerable.Empty<IAsyncEnumerable<int>>());
-
-            var e = res.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task Catch13()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.Catch(new[] { xs, xs, ys, ys });
-
-            await SequenceIdentity(res);
-        }
-
-        [Fact]
-        public async Task Catch14()
-        {
-            var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = xs.Catch<int, Exception>(ex_ => { err = true; return ys; });
-
-            await SequenceIdentity(res);
-
-            Assert.False(err);
-        }
-
-        [Fact]
-        public void Finally_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Finally(default(IAsyncEnumerable<int>), () => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Finally(AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void Finally1()
-        {
-            var b = false;
-
-            var xs = AsyncEnumerable.Empty<int>().Finally(() => { b = true; });
-
-            var e = xs.GetEnumerator();
-
-            Assert.False(b);
-            NoNext(e);
-
-            Assert.True(b);
-        }
-
-        [Fact]
-        public void Finally2()
-        {
-            var b = false;
-
-            var xs = AsyncEnumerable.Return(42).Finally(() => { b = true; });
-
-            var e = xs.GetEnumerator();
-
-            Assert.False(b);
-            HasNext(e, 42);
-
-            Assert.False(b);
-            NoNext(e);
-
-            Assert.True(b);
-        }
-
-        [Fact]
-        public void Finally3()
-        {
-            var ex = new Exception("Bang!");
-
-            var b = false;
-
-            var xs = AsyncEnumerable.Throw<int>(ex).Finally(() => { b = true; });
-
-            var e = xs.GetEnumerator();
-
-            Assert.False(b);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-
-            Assert.True(b);
-        }
-
-        [Fact]
-        public void Finally4()
-        {
-            var b = false;
-
-            var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; });
-
-            var e = xs.GetEnumerator();
-
-            Assert.False(b);
-            HasNext(e, 1);
-
-            Assert.False(b);
-            HasNext(e, 2);
-
-            Assert.False(b);
-            NoNext(e);
-
-            Assert.True(b);
-        }
-
-        [Fact]
-        public void Finally5()
-        {
-            var b = false;
-
-            var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; });
-
-            var e = xs.GetEnumerator();
-
-            Assert.False(b);
-            HasNext(e, 1);
-
-            e.Dispose();
-
-            Assert.True(b);
-        }
-
-        [Fact]
-        public async Task Finally6()
-        {
-            var b = false;
-
-            var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { Volatile.Write(ref b, true); });
-
-            var e = xs.GetEnumerator();
-
-            var cts = new CancellationTokenSource();
-
-            var t = e.MoveNext(cts.Token);
-            cts.Cancel();
-            t.Wait(WaitTimeoutMs);
-
-            for (var i = 0; i < WaitTimeoutMs / 100; i++)
-            {
-                if (Volatile.Read(ref b))
-                {
-                    return;
-                }
-                await Task.Delay(100);
-            }
-
-            Assert.True(true, "Timeout while waiting for b to become true.");
-        }
-
-        [Fact]
-        public async Task Finally7()
-        {
-            var i = 0;
-            var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { i++; });
-
-            await SequenceIdentity(xs);
-            Assert.Equal(2, i);
-        }
-
-
-        [Fact]
-        public void OnErrorResumeNext_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OnErrorResumeNext<int>(default, AsyncEnumerable.Return(42)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OnErrorResumeNext<int>(AsyncEnumerable.Return(42), default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OnErrorResumeNext<int>(default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OnErrorResumeNext<int>(default(IEnumerable<IAsyncEnumerable<int>>)));
-        }
-
-        [Fact]
-        public void OnErrorResumeNext7()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.OnErrorResumeNext(xs, ys);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void OnErrorResumeNext8()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.OnErrorResumeNext(xs, ys);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void OnErrorResumeNext9()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.OnErrorResumeNext(new[] { xs, xs, ys, ys });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void OnErrorResumeNext10()
-        {
-            var res = OnErrorResumeNextXss().OnErrorResumeNext();
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!");
-        }
-
-        private IEnumerable<IAsyncEnumerable<int>> OnErrorResumeNextXss()
-        {
-            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(new Exception("!!!")));
-            throw new Exception("Bang!");
-        }
-
-        [Fact]
-        public void OnErrorResumeNext11()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-
-            var res = AsyncEnumerable.OnErrorResumeNext(new[] { xs, xs });
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void OnErrorResumeNext12()
-        {
-            var res = AsyncEnumerable.OnErrorResumeNext(Enumerable.Empty<IAsyncEnumerable<int>>());
-
-            var e = res.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task OnErrorResumeNext13()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.OnErrorResumeNext(xs, ys);
-
-            await SequenceIdentity(res);
-        }
-
-        [Fact]
-        public void Retry_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Retry<int>(default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Retry<int>(default, 1));
-            AssertThrows<ArgumentOutOfRangeException>(() => AsyncEnumerable.Retry<int>(AsyncEnumerable.Return(42), -1));
-        }
-
-        [Fact]
-        public void Retry1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-
-            var res = xs.Retry();
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Retry2()
-        {
-            var ex = new InvalidOperationException("Bang!");
-
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-
-            var res = xs.Retry();
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-        }
-    }
-}

+ 0 - 1062
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Multiple.cs

@@ -1,1062 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace Tests
-{
-    public partial class AsyncTests
-    {
-        [Fact]
-        public void Concat_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Concat<int>(null, AsyncEnumerable.Return(42)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Concat<int>(AsyncEnumerable.Return(42), null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Concat<int>(default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Concat<int>(default(IEnumerable<IAsyncEnumerable<int>>)));
-        }
-
-        [Fact]
-        public void Concat1()
-        {
-            var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable());
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Concat2()
-        {
-            var ex = new Exception("Bang");
-            var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Concat3()
-        {
-            var ex = new Exception("Bang");
-            var ys = AsyncEnumerable.Throw<int>(ex).Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable());
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Concat4()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
-            var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.Concat(xs, ys, zs);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            HasNext(e, 7);
-            HasNext(e, 8);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Concat5()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
-            var zs = AsyncEnumerable.Throw<int>(ex);
-
-            var res = AsyncEnumerable.Concat(xs, ys, zs);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Concat6()
-        {
-            var res = AsyncEnumerable.Concat(ConcatXss());
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!");
-        }
-
-        [Fact]
-        public void Concat7()
-        {
-            var ws = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var xs = new[] { 4, 5 }.ToAsyncEnumerable();
-            var ys = new[] { 6, 7, 8 }.ToAsyncEnumerable();
-            var zs = new[] { 9, 10, 11 }.ToAsyncEnumerable();
-
-            var res = ws.Concat(xs).Concat(ys).Concat(zs);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            HasNext(e, 7);
-            HasNext(e, 8);
-            HasNext(e, 9);
-            HasNext(e, 10);
-            HasNext(e, 11);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task Concat8()
-        {
-            var ws = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var xs = new[] { 4, 5 }.ToAsyncEnumerable();
-            var ys = new[] { 6, 7, 8 }.ToAsyncEnumerable();
-            var zs = new[] { 9, 10, 11 }.ToAsyncEnumerable();
-
-            var res = ws.Concat(xs).Concat(ys).Concat(zs);
-
-            await SequenceIdentity(res);
-        }
-
-        [Fact]
-        public async Task Concat9()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
-            var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable();
-
-            var res = AsyncEnumerable.Concat(xs, ys, zs);
-
-            await SequenceIdentity(res);
-        }
-
-        [Fact]
-        public async Task Concat10()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
-            var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable();
-
-            var c = xs.Concat(ys).Concat(zs);
-
-            var res = new[] { 1, 2, 3, 4, 5, 6, 7, 8 };
-            Assert.True(res.SequenceEqual(await c.ToArray()));
-        }
-
-        [Fact]
-        public async Task Concat11()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
-            var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable();
-
-            var c = xs.Concat(ys).Concat(zs);
-
-            var res = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8 };
-            Assert.True(res.SequenceEqual(await c.ToList()));
-        }
-
-        [Fact]
-        public async Task Concat12()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
-            var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable();
-
-            var c = xs.Concat(ys).Concat(zs);
-
-            Assert.Equal(8, await c.Count());
-        }
-
-        private static IEnumerable<IAsyncEnumerable<int>> ConcatXss()
-        {
-            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            yield return new[] { 4, 5 }.ToAsyncEnumerable();
-            throw new Exception("Bang!");
-        }
-
-        [Fact]
-        public void Zip_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Zip<int, int, int>(null, AsyncEnumerable.Return(42), (x, y) => x + y));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Zip<int, int, int>(AsyncEnumerable.Return(42), null, (x, y) => x + y));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Zip<int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void Zip1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-            var res = xs.Zip(ys, (x, y) => x * y);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1 * 4);
-            HasNext(e, 2 * 5);
-            HasNext(e, 3 * 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Zip2()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6, 7 }.ToAsyncEnumerable();
-            var res = xs.Zip(ys, (x, y) => x * y);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1 * 4);
-            HasNext(e, 2 * 5);
-            HasNext(e, 3 * 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Zip3()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-            var res = xs.Zip(ys, (x, y) => x * y);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1 * 4);
-            HasNext(e, 2 * 5);
-            HasNext(e, 3 * 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Zip4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
-            var res = xs.Zip(ys, (x, y) => x * y);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Zip5()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var res = xs.Zip(ys, (x, y) => x * y);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Zip6()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var res = xs.Zip(ys, (x, y) => { if (x > 0) { throw ex; } return x * y; });
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Zip7()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
-            var res = xs.Zip(ys, (x, y) => x * y);
-
-            await SequenceIdentity(res);
-        }
-
-        [Fact]
-        public void Union_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(null, AsyncEnumerable.Return(42)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(AsyncEnumerable.Return(42), null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(null, AsyncEnumerable.Return(42), new Eq()));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(AsyncEnumerable.Return(42), null, new Eq()));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void Union1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
-            var res = xs.Union(ys);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 5);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Union2()
-        {
-            var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable();
-            var res = xs.Union(ys, new Eq());
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, -3);
-            HasNext(e, 5);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Intersect_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(null, AsyncEnumerable.Return(42)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(AsyncEnumerable.Return(42), null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(null, AsyncEnumerable.Return(42), new Eq()));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(AsyncEnumerable.Return(42), null, new Eq()));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void Intersect1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
-            var res = xs.Intersect(ys);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 3);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Intersect2()
-        {
-            var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable();
-            var res = xs.Intersect(ys, new Eq());
-
-            var e = res.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, -3);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task Intersect3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
-            var res = xs.Intersect(ys);
-
-            await SequenceIdentity(res);
-        }
-
-
-        [Fact]
-        public void Except_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(null, AsyncEnumerable.Return(42)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(AsyncEnumerable.Return(42), null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(null, AsyncEnumerable.Return(42), new Eq()));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(AsyncEnumerable.Return(42), null, new Eq()));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void Except1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
-            var res = xs.Except(ys);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Except2()
-        {
-            var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable();
-            var res = xs.Except(ys, new Eq());
-
-            var e = res.GetEnumerator();
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task Except3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
-            var res = xs.Except(ys);
-
-            await SequenceIdentity(res);
-        }
-
-        [Fact]
-        public async Task SequenceEqual_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(null, AsyncEnumerable.Return(42)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(null, AsyncEnumerable.Return(42), new Eq()));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(AsyncEnumerable.Return(42), null, new Eq()));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(null, AsyncEnumerable.Return(42), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(AsyncEnumerable.Return(42), null, CancellationToken.None));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(null, AsyncEnumerable.Return(42), new Eq(), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(AsyncEnumerable.Return(42), null, new Eq(), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.SequenceEqual<int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, CancellationToken.None));
-        }
-
-        [Fact]
-        public void SequenceEqual1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(xs);
-            Assert.True(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual2()
-        {
-            var xs = AsyncEnumerable.Empty<int>();
-            var res = xs.SequenceEqual(xs);
-            Assert.True(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 1, 3, 2 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys);
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual4()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys);
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual5()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys);
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual6()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
-            var res = xs.SequenceEqual(ys);
-
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SequenceEqual7()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys);
-
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SequenceEqual8()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(xs, new Eq());
-            Assert.True(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual9()
-        {
-            var xs = AsyncEnumerable.Empty<int>();
-            var res = xs.SequenceEqual(xs, new Eq());
-            Assert.True(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual10()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 1, 3, 2 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys, new Eq());
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual11()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys, new Eq());
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual12()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys, new Eq());
-            Assert.False(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual13()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
-            var res = xs.SequenceEqual(ys, new Eq());
-
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SequenceEqual14()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys, new Eq());
-
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SequenceEqual15()
-        {
-            var xs = new[] { 1, 2, -3, 4 }.ToAsyncEnumerable();
-            var ys = new[] { 1, -2, 3, 4 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys, new Eq());
-            Assert.True(res.Result);
-        }
-
-        [Fact]
-        public void SequenceEqual16()
-        {
-            var xs = new[] { 1, 2, -3, 4 }.ToAsyncEnumerable();
-            var ys = new[] { 1, -2, 3, 4 }.ToAsyncEnumerable();
-            var res = xs.SequenceEqual(ys, new EqEx());
-            AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException);
-        }
-
-        private class EqEx : IEqualityComparer<int>
-        {
-            public bool Equals(int x, int y)
-            {
-                throw new NotImplementedException();
-            }
-
-            public int GetHashCode(int obj)
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        [Fact]
-        public void GroupJoin_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupJoin<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, default));
-        }
-
-        [Fact]
-        public void GroupJoin1()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 4, 7, 6, 2, 3, 4, 8, 9 }.ToAsyncEnumerable();
-
-            var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
-
-            var e = res.GetEnumerator();
-            HasNext(e, "0 - 639");
-            HasNext(e, "1 - 474");
-            HasNext(e, "2 - 28");
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupJoin2()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable();
-
-            var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
-
-            var e = res.GetEnumerator();
-            HasNext(e, "0 - 36");
-            HasNext(e, "1 - 4");
-            HasNext(e, "2 - ");
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupJoin3()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable();
-
-            var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void GroupJoin4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
-
-            var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void GroupJoin5()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable();
-
-            var res = xs.GroupJoin(ys, x => { throw ex; }, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void GroupJoin6()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable();
-
-            var res = xs.GroupJoin(ys, x => x % 3, y => { throw ex; }, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void GroupJoin7()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable();
-
-            var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) =>
-            {
-                if (x == 1)
-                {
-                    throw ex;
-                }
-
-                return x + " - " + i.Aggregate("", (s, j) => s + j).Result;
-            });
-
-            var e = res.GetEnumerator();
-            HasNext(e, "0 - 36");
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Join_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Join<int, int, int, int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, default));
-        }
-
-        [Fact]
-        public void Join1()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable();
-
-            var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 0 + 3);
-            HasNext(e, 0 + 6);
-            HasNext(e, 1 + 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Join2()
-        {
-            var xs = new[] { 3, 6, 4 }.ToAsyncEnumerable();
-            var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-
-            var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 3 + 0);
-            HasNext(e, 6 + 0);
-            HasNext(e, 4 + 1);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Join3()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 6 }.ToAsyncEnumerable();
-
-            var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 0 + 3);
-            HasNext(e, 0 + 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Join4()
-        {
-            var xs = new[] { 3, 6 }.ToAsyncEnumerable();
-            var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-
-            var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 3 + 0);
-            HasNext(e, 6 + 0);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Join5()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-
-            var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Join6()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
-
-            var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Join7()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-
-            var res = xs.Join(ys, x => { throw ex; }, y => y, (x, y) => x + y);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Join8()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-
-            var res = xs.Join(ys, x => x, y => { throw ex; }, (x, y) => x + y);
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Join9()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-
-            var res = xs.Join<int, int, int, int>(ys, x => x, y => y, (x, y) => { throw ex; });
-
-            var e = res.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Join10()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable();
-
-            var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
-
-            await SequenceIdentity(res);
-        }
-
-
-        [Fact]
-        public void Join11()
-        {
-            var customers = new List<Customer>
-            {
-                new Customer {CustomerId = "ALFKI"},
-                new Customer {CustomerId = "ANANT"},
-                new Customer {CustomerId = "FISSA"}
-            };
-            var orders = new List<Order>
-            {
-                new Order { OrderId = 1, CustomerId = "ALFKI"},
-                new Order { OrderId = 2, CustomerId = "ALFKI"},
-                new Order { OrderId = 3, CustomerId = "ALFKI"},
-                new Order { OrderId = 4, CustomerId = "FISSA"},
-                new Order { OrderId = 5, CustomerId = "FISSA"},
-                new Order { OrderId = 6, CustomerId = "FISSA"},
-            };
-
-            var asyncResult = customers.ToAsyncEnumerable()
-                                       .Join(orders.ToAsyncEnumerable(), c => c.CustomerId, o => o.CustomerId,
-                                            (c, o) => new CustomerOrder { CustomerId = c.CustomerId, OrderId = o.OrderId });
-
-            var e = asyncResult.GetEnumerator();
-            HasNext(e, new CustomerOrder { CustomerId = "ALFKI", OrderId = 1 });
-            HasNext(e, new CustomerOrder { CustomerId = "ALFKI", OrderId = 2 });
-            HasNext(e, new CustomerOrder { CustomerId = "ALFKI", OrderId = 3 });
-            HasNext(e, new CustomerOrder { CustomerId = "FISSA", OrderId = 4 });
-            HasNext(e, new CustomerOrder { CustomerId = "FISSA", OrderId = 5 });
-            HasNext(e, new CustomerOrder { CustomerId = "FISSA", OrderId = 6 });
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Join12()
-        {
-            var customers = new List<Customer>
-            {
-                new Customer {CustomerId = "ANANT"},
-                new Customer {CustomerId = "ALFKI"},
-                new Customer {CustomerId = "FISSA"}
-            };
-            var orders = new List<Order>
-            {
-                new Order { OrderId = 1, CustomerId = "ALFKI"},
-                new Order { OrderId = 2, CustomerId = "ALFKI"},
-                new Order { OrderId = 3, CustomerId = "ALFKI"},
-                new Order { OrderId = 4, CustomerId = "FISSA"},
-                new Order { OrderId = 5, CustomerId = "FISSA"},
-                new Order { OrderId = 6, CustomerId = "FISSA"},
-            };
-
-            var asyncResult = customers.ToAsyncEnumerable()
-                                       .Join(orders.ToAsyncEnumerable(), c => c.CustomerId, o => o.CustomerId,
-                                            (c, o) => new CustomerOrder { CustomerId = c.CustomerId, OrderId = o.OrderId });
-
-            var e = asyncResult.GetEnumerator();
-            HasNext(e, new CustomerOrder { CustomerId = "ALFKI", OrderId = 1 });
-            HasNext(e, new CustomerOrder { CustomerId = "ALFKI", OrderId = 2 });
-            HasNext(e, new CustomerOrder { CustomerId = "ALFKI", OrderId = 3 });
-            HasNext(e, new CustomerOrder { CustomerId = "FISSA", OrderId = 4 });
-            HasNext(e, new CustomerOrder { CustomerId = "FISSA", OrderId = 5 });
-            HasNext(e, new CustomerOrder { CustomerId = "FISSA", OrderId = 6 });
-            NoNext(e);
-        }
-
-
-        [Fact]
-        public void SelectManyMultiple_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int>(default, AsyncEnumerable.Return(42)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int>(AsyncEnumerable.Return(42), default(IAsyncEnumerable<int>)));
-        }
-
-        [Fact]
-        public void SelectManyMultiple1()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = new[] { 3, 4 }.ToAsyncEnumerable();
-
-            var res = xs.SelectMany(ys);
-
-            var e = res.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-
-        public class Customer
-        {
-            public string CustomerId { get; set; }
-        }
-
-        public class Order
-        {
-            public int OrderId { get; set; }
-            public string CustomerId { get; set; }
-        }
-
-        [DebuggerDisplay("CustomerId = {CustomerId}, OrderId = {OrderId}")]
-        public class CustomerOrder : IEquatable<CustomerOrder>
-        {
-            public bool Equals(CustomerOrder other)
-            {
-                if (other is null)
-                {
-                    return false;
-                }
-
-                if (ReferenceEquals(this, other))
-                {
-                    return true;
-                }
-
-                return OrderId == other.OrderId && string.Equals(CustomerId, other.CustomerId);
-            }
-
-            public override bool Equals(object obj)
-            {
-                if (obj is null)
-                {
-                    return false;
-                }
-
-                if (ReferenceEquals(this, obj))
-                {
-                    return true;
-                }
-
-                if (obj.GetType() != GetType())
-                {
-                    return false;
-                }
-
-                return Equals((CustomerOrder)obj);
-            }
-
-            public override int GetHashCode()
-            {
-                unchecked
-                {
-                    return (OrderId * 397) ^ (CustomerId != null ? CustomerId.GetHashCode() : 0);
-                }
-            }
-
-            public static bool operator ==(CustomerOrder left, CustomerOrder right)
-            {
-                return Equals(left, right);
-            }
-
-            public static bool operator !=(CustomerOrder left, CustomerOrder right)
-            {
-                return !Equals(left, right);
-            }
-
-            public int OrderId { get; set; }
-            public string CustomerId { get; set; }
-        }
-
-    }
-}

+ 0 - 3556
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Single.cs

@@ -1,3556 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit;
-namespace Tests
-{
-
-    public partial class AsyncTests
-    {
-        [Fact]
-        public void MoveNextExtension_Null()
-        {
-            var en = default(IAsyncEnumerator<int>);
-
-            Assert.ThrowsAsync<ArgumentNullException>(() => en.MoveNext());
-        }
-
-        [Fact]
-        public void MoveNextExtension()
-        {
-            var enumerable = new CancellationTestAsyncEnumerable();
-            var en = enumerable.GetEnumerator();
-
-            en.MoveNext();
-
-            Assert.True(en.MoveNextWasCalled);
-            Assert.Equal(CancellationToken.None, en.LastToken);
-        }
-
-        [Fact]
-        public void Select_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Select<int, int>(null, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Select<int, int>(null, (x, i) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Select<int, int>(AsyncEnumerable.Return<int>(42), default(Func<int, int>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Select<int, int>(AsyncEnumerable.Return<int>(42), default(Func<int, int, int>)));
-        }
-
-        [Fact]
-        public void Select1()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = xs.Select(x => (char)('a' + x));
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 'a');
-            HasNext(e, 'b');
-            HasNext(e, 'c');
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Select2()
-        {
-            var xs = new[] { 8, 5, 7 }.ToAsyncEnumerable();
-            var ys = xs.Select((x, i) => (char)('a' + i));
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 'a');
-            HasNext(e, 'b');
-            HasNext(e, 'c');
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Select3()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = xs.Select(x => 1 / x);
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is DivideByZeroException);
-        }
-
-        [Fact]
-        public void Select4()
-        {
-            var xs = new[] { 8, 5, 7 }.ToAsyncEnumerable();
-            var ys = xs.Select((x, i) => 1 / i);
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is DivideByZeroException);
-        }
-
-        [Fact]
-        public void Select5()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = xs.Select(i => i + 3).Select(x => (char)('a' + x));
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 'd');
-            HasNext(e, 'e');
-            HasNext(e, 'f');
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Select6()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10);
-            var ys = xs.Select(i => i + 3).Select(x => (char)('a' + x));
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 'd');
-            HasNext(e, 'e');
-            HasNext(e, 'f');
-        }
-
-        [Fact]
-        public async Task Select7()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = xs.Select(x => (char)('a' + x));
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task Select8()
-        {
-            var xs = new[] { 8, 5, 7 }.ToAsyncEnumerable();
-            var ys = xs.Select((x, i) => (char)('a' + i));
-
-            await SequenceIdentity(ys);
-        }
-
-
-        [Fact]
-        public void SelectWhere1()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10);
-            var ys = xs.Select(i => i + 2).Where(i => i % 2 == 0);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 4);
-            HasNext(e, 6);
-        }
-
-        [Fact]
-        public void WhereSelect1()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10);
-            var ys = xs.Where(i => i % 2 == 0).Select(i => i + 2);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 4);
-            HasNext(e, 6);
-        }
-
-
-        [Fact]
-        public void SelectWhere2()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = xs.Select(i => i + 2).Where(i => i % 2 == 0);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 4);
-            NoNext(e);
-
-        }
-
-        [Fact]
-        public void WhereSelect2()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = xs.Where(i => i % 2 == 0).Select(i => i + 2);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void WhereSelect3()
-        {
-            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = xs.Where(i => i % 2 == 0).Select(i => i + 2).Select(i => i + 2);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 4);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task WhereSelect4()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10).Take(5);
-            var ys = xs.Where(i => i % 2 == 0).Select(i => i + 2);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public void Where_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Where<int>(null, x => true));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Where<int>(null, (x, i) => true));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Where<int>(AsyncEnumerable.Return<int>(42), default(Func<int, bool>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Where<int>(AsyncEnumerable.Return<int>(42), default(Func<int, int, bool>)));
-        }
-
-        [Fact]
-        public void Where1()
-        {
-            var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable();
-            var ys = xs.Where(x => x % 2 == 0);
-            var e = ys.GetEnumerator();
-            HasNext(e, 8);
-            HasNext(e, 4);
-            HasNext(e, 6);
-            HasNext(e, 2);
-            HasNext(e, 0);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Where2()
-        {
-            var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable();
-            var ys = xs.Where((x, i) => i % 2 == 0);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 8);
-            HasNext(e, 7);
-            HasNext(e, 6);
-            HasNext(e, 2);
-            HasNext(e, 0);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Where3()
-        {
-            var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable();
-            var ex = new Exception("Bang");
-            var ys = xs.Where(x => { if (x == 4) { throw ex; } return true; });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 8);
-            HasNext(e, 5);
-            HasNext(e, 7);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Where4()
-        {
-            var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable();
-            var ex = new Exception("Bang");
-            var ys = xs.Where((x, i) => { if (i == 3) { throw ex; } return true; });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 8);
-            HasNext(e, 5);
-            HasNext(e, 7);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Where5()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Where(x => true);
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Where6()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-
-            var ys = xs.Where((x, i) => true);
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-
-        [Fact]
-        public void Where7()
-        {
-            var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable();
-            var ys = xs.Where(x => x % 2 == 0).Where(x => x > 5);
-            var e = ys.GetEnumerator();
-            HasNext(e, 8);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task Where8()
-        {
-            var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable();
-            var ys = xs.Where(x => x % 2 == 0);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task Where9()
-        {
-            var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable();
-            var ys = xs.Where((x, i) => i % 2 == 0);
-
-            await SequenceIdentity(ys);
-        }
-
-
-        [Fact]
-        public void SelectMany_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int>(null, x => null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int>(null, (x, i) => null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int>(AsyncEnumerable.Return(42), default(Func<int, IAsyncEnumerable<int>>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int>(AsyncEnumerable.Return(42), default(Func<int, int, IAsyncEnumerable<int>>)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int, int>(null, x => null, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int, int>(null, (x, i) => null, (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int, int>(AsyncEnumerable.Return(42), default(Func<int, IAsyncEnumerable<int>>), (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int, int>(AsyncEnumerable.Return(42), default(Func<int, int, IAsyncEnumerable<int>>), (x, y) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int, int>(AsyncEnumerable.Return(42), x => null, default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SelectMany<int, int, int>(AsyncEnumerable.Return(42), (x, i) => null, default));
-        }
-
-        [Fact]
-        public void SelectMany1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable());
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 0);
-            HasNext(e, 1);
-            HasNext(e, 0);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SelectMany2()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany(x =>
-            {
-                if (x < 3)
-                {
-                    return Enumerable.Range(0, x).ToAsyncEnumerable();
-                }
-                else
-                {
-                    return AsyncEnumerable.Throw<int>(ex);
-                }
-            });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 0);
-            HasNext(e, 1);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SelectMany3()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable());
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SelectMany4()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany(x =>
-            {
-                if (x < 3)
-                {
-                    return Enumerable.Range(0, x).ToAsyncEnumerable();
-                }
-                else
-                {
-                    throw ex;
-                }
-            });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 0);
-            HasNext(e, 1);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SelectMany5()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 5, x).ToAsyncEnumerable());
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 5);
-            HasNext(e, 6);
-            HasNext(e, 7);
-            HasNext(e, 7);
-            HasNext(e, 8);
-            HasNext(e, 9);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SelectMany6()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany((x, i) =>
-            {
-                if (i < 2)
-                {
-                    return Enumerable.Range(0, x).ToAsyncEnumerable();
-                }
-                else
-                {
-                    return AsyncEnumerable.Throw<int>(ex);
-                }
-            });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 0);
-            HasNext(e, 1);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SelectMany7()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.SelectMany((x, i) => Enumerable.Range(0, x).ToAsyncEnumerable());
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SelectMany8()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany((x, i) =>
-            {
-                if (i < 2)
-                {
-                    return Enumerable.Range(0, x).ToAsyncEnumerable();
-                }
-                else
-                {
-                    throw ex;
-                }
-            });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 0);
-            HasNext(e, 1);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SelectMany9()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany(x => Enumerable.Range(3, x).ToAsyncEnumerable(), (x, y) => x * y);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 6);
-            HasNext(e, 8);
-            HasNext(e, 9);
-            HasNext(e, 12);
-            HasNext(e, 15);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SelectMany10()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 3, x).ToAsyncEnumerable(), (x, y) => x * y);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 8);
-            HasNext(e, 10);
-            HasNext(e, 15);
-            HasNext(e, 18);
-            HasNext(e, 21);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SelectMany11()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany(x => Enumerable.Range(3, x).ToAsyncEnumerable(), (x, y) =>
-            {
-                if (x * y > 10)
-                {
-                    throw ex;
-                }
-
-                return x * y;
-            });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 6);
-            HasNext(e, 8);
-            HasNext(e, 9);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SelectMany12()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 3, x).ToAsyncEnumerable(), (x, y) =>
-            {
-                if (x * y > 10)
-                {
-                    throw ex;
-                }
-
-                return x * y;
-            });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 8);
-            HasNext(e, 10);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task SelectMany13()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable());
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task SelectMany14()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 5, x).ToAsyncEnumerable());
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task SelectMany15()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany(x => Enumerable.Range(3, x).ToAsyncEnumerable(), (x, y) => x * y);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task SelectMany16()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 3, x).ToAsyncEnumerable(), (x, y) => x * y);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public void OfType_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OfType<int>(null));
-        }
-
-        [Fact]
-        public void OfType()
-        {
-            var xs = new object[] { 1, 1.2, true, 4, "" }.ToAsyncEnumerable();
-            var ys = xs.OfType<int>();
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Cast_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Cast<int>(null));
-        }
-
-        [Fact]
-        public void Cast1()
-        {
-            var xs = new object[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Cast<int>();
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Cast2()
-        {
-            var xs = new[] { new EventArgs(), new EventArgs(), new EventArgs() }.ToAsyncEnumerable();
-            var ys = xs.Cast<EventArgs>();
-
-            Assert.Same(xs, ys);
-        }
-
-        [Fact]
-        public void Do_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(null, x => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), default(Action<int>)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(null, x => { }, () => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), default, () => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), x => { }, default(Action)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(null, x => { }, ex => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), default, ex => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), x => { }, default(Action<Exception>)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(null, x => { }, ex => { }, () => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), default, ex => { }, () => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), x => { }, default, () => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), x => { }, ex => { }, default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(null, new MyObs()));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Do<int>(AsyncEnumerable.Return(42), default(IObserver<int>)));
-        }
-
-        private class MyObs : IObserver<int>
-        {
-            public void OnCompleted()
-            {
-                throw new NotImplementedException();
-            }
-
-            public void OnError(Exception error)
-            {
-                throw new NotImplementedException();
-            }
-
-            public void OnNext(int value)
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        [Fact]
-        public void Do1()
-        {
-            var sum = 0;
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Do(x => sum += x);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            Assert.Equal(1, sum);
-            HasNext(e, 2);
-            Assert.Equal(3, sum);
-            HasNext(e, 3);
-            Assert.Equal(6, sum);
-            HasNext(e, 4);
-            Assert.Equal(10, sum);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Do2()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Do(x => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Do3()
-        {
-            var sum = 0;
-            var fail = false;
-            var done = false;
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Do(x => sum += x, ex => { fail = true; }, () => { done = true; });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            Assert.Equal(1, sum);
-            HasNext(e, 2);
-            Assert.Equal(3, sum);
-            HasNext(e, 3);
-            Assert.Equal(6, sum);
-            HasNext(e, 4);
-            Assert.Equal(10, sum);
-            NoNext(e);
-
-            Assert.False(fail);
-            Assert.True(done);
-        }
-
-        [Fact]
-        public void Do4()
-        {
-            var sum = 0;
-            var done = false;
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Do(x => sum += x, () => { done = true; });
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            Assert.Equal(1, sum);
-            HasNext(e, 2);
-            Assert.Equal(3, sum);
-            HasNext(e, 3);
-            Assert.Equal(6, sum);
-            HasNext(e, 4);
-            Assert.Equal(10, sum);
-            NoNext(e);
-
-            Assert.True(done);
-        }
-
-        [Fact]
-        public void Do5()
-        {
-            var ex = new Exception("Bang");
-            var exa = default(Exception);
-            var done = false;
-            var hasv = false;
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; }, () => { done = true; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ex_.InnerException == ex);
-
-            Assert.False(hasv);
-            Assert.False(done);
-            Assert.Same(exa, ex);
-        }
-
-        [Fact]
-        public void Do6()
-        {
-            var ex = new Exception("Bang");
-            var exa = default(Exception);
-            var hasv = false;
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ex_.InnerException == ex);
-
-            Assert.False(hasv);
-            Assert.Same(exa, ex);
-        }
-
-        [Fact]
-        public async Task Do7()
-        {
-            var sum = 0;
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Do(x => sum += x);
-
-            await SequenceIdentity(ys);
-
-            Assert.Equal(20, sum);
-        }
-
-        [Fact]
-        public async Task ForEachAsync_Null()
-        {
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ForEachAsync<int>(null, x => { }));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ForEachAsync<int>(AsyncEnumerable.Return(42), default(Action<int>)));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ForEachAsync<int>(null, (x, i) => { }));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ForEachAsync<int>(AsyncEnumerable.Return(42), default(Action<int, int>)));
-
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ForEachAsync<int>(null, x => { }, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ForEachAsync<int>(AsyncEnumerable.Return(42), default(Action<int>), CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ForEachAsync<int>(null, (x, i) => { }, CancellationToken.None));
-            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerable.ForEachAsync<int>(AsyncEnumerable.Return(42), default(Action<int, int>), CancellationToken.None));
-        }
-
-        [Fact]
-        public void ForEach_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ForEach<int>(null, x => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ForEach<int>(AsyncEnumerable.Return(42), default(Action<int>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ForEach<int>(null, (x, i) => { }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ForEach<int>(AsyncEnumerable.Return(42), default(Action<int, int>)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ForEach<int>(null, x => { }, CancellationToken.None));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ForEach<int>(AsyncEnumerable.Return(42), default(Action<int>), CancellationToken.None));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ForEach<int>(null, (x, i) => { }, CancellationToken.None));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ForEach<int>(AsyncEnumerable.Return(42), default(Action<int, int>), CancellationToken.None));
-        }
-
-        [Fact]
-        public void ForEachAsync1()
-        {
-            var sum = 0;
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-
-            xs.ForEachAsync(x => sum += x).Wait(WaitTimeoutMs);
-            Assert.Equal(10, sum);
-        }
-
-        [Fact]
-        public void ForEach1()
-        {
-            var sum = 0;
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-
-            xs.ForEach(x => sum += x);
-            Assert.Equal(10, sum);
-        }
-
-        [Fact]
-        public void ForEachAsync2()
-        {
-            var sum = 0;
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-
-            xs.ForEach((x, i) => sum += x * i);
-            Assert.Equal(1 * 0 + 2 * 1 + 3 * 2 + 4 * 3, sum);
-        }
-
-        [Fact]
-        public void ForEach2()
-        {
-            var sum = 0;
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-
-            xs.ForEachAsync((x, i) => sum += x * i).Wait(WaitTimeoutMs);
-            Assert.Equal(1 * 0 + 2 * 1 + 3 * 2 + 4 * 3, sum);
-        }
-
-        [Fact]
-        public void ForEachAsync3()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-
-            AssertThrows<Exception>(() => xs.ForEachAsync(x => { throw ex; }).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ForEach3()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-
-            AssertThrows<Exception>(() => xs.ForEach(x => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ForEachAsync4()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-
-            AssertThrows<Exception>(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ForEach4()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-
-            AssertThrows<Exception>(() => xs.ForEach((x, i) => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ForEachAsync5()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-
-            AssertThrows<Exception>(() => xs.ForEachAsync(x => { throw ex; }).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ForEach5()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-
-            AssertThrows<Exception>(() => xs.ForEach(x => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ForEachAsync6()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-
-            AssertThrows<Exception>(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void ForEach6()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-
-            AssertThrows<Exception>(() => xs.ForEach((x, i) => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Take_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Take<int>(null, 5));
-        }
-
-        [Fact]
-        public void Take0()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Take(-2);
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Take1()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Take(2);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Take2()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Take(10);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Take3()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Take(0);
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Take4()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Take(2);
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Take5()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Take(2);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public void TakeWhile_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.TakeWhile<int>(null, x => true));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.TakeWhile<int>(null, (x, i) => true));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.TakeWhile<int>(AsyncEnumerable.Return(42), default(Func<int, bool>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.TakeWhile<int>(AsyncEnumerable.Return(42), default(Func<int, int, bool>)));
-        }
-
-        [Fact]
-        public void TakeWhile1()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile(x => x < 3);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeWhile2()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile(x => false);
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeWhile3()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile(x => true);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeWhile4()
-        {
-            var xs = new[] { 1, 2, 3, 4, 3, 2, 1 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile(x => x < 3);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeWhile5()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile(x => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void TakeWhile6()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile((x, i) => i < 2);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeWhile7()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile((x, i) => false);
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeWhile8()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile((x, i) => true);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeWhile9()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile((x, i) => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-
-        [Fact]
-        public async Task TakeWhile10()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile(x => x < 3);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task TakeWhile11()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.TakeWhile((x, i) => i < 2);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public void Skip_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Skip<int>(null, 5));
-        }
-
-        //[Fact]
-        //public void Skip0()
-        //{
-        //    var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-        //    var ys = xs.Skip(-2);
-
-        //    var e = ys.GetEnumerator();
-        //    NoNext(e);
-        //}
-
-        [Fact]
-        public void Skip1()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Skip(2);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Skip2()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Skip(10);
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Skip3()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Skip(0);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Skip4()
-        {
-            var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Skip(2);
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Skip5()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Skip(2);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public void SkipWhile_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SkipWhile<int>(null, x => true));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SkipWhile<int>(null, (x, i) => true));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SkipWhile<int>(AsyncEnumerable.Return(42), default(Func<int, bool>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SkipWhile<int>(AsyncEnumerable.Return(42), default(Func<int, int, bool>)));
-        }
-
-        [Fact]
-        public void SkipWhile1()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile(x => x < 3);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipWhile2()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile(x => false);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipWhile3()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile(x => true);
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipWhile4()
-        {
-            var xs = new[] { 1, 2, 3, 4, 3, 2, 1 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile(x => x < 3);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 3);
-            HasNext(e, 2);
-            HasNext(e, 1);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipWhile5()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile(x => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void SkipWhile6()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile((x, i) => i < 2);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipWhile7()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile((x, i) => false);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipWhile8()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile((x, i) => true);
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipWhile9()
-        {
-            var ex = new Exception("Bang");
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile((x, i) => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task SkipWhile10()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile(x => x < 3);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task SkipWhile11()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.SkipWhile((x, i) => false);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public void DefaultIfEmpty_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DefaultIfEmpty<int>(null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DefaultIfEmpty<int>(null, 42));
-        }
-
-        [Fact]
-        public void DefaultIfEmpty1()
-        {
-            var xs = AsyncEnumerable.Empty<int>().DefaultIfEmpty();
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 0);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void DefaultIfEmpty2()
-        {
-            var xs = AsyncEnumerable.Empty<int>().DefaultIfEmpty(42);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 42);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void DefaultIfEmpty3()
-        {
-            var xs = AsyncEnumerable.Return<int>(42).DefaultIfEmpty();
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 42);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void DefaultIfEmpty4()
-        {
-            var xs = AsyncEnumerable.Return<int>(42).DefaultIfEmpty(24);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 42);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void DefaultIfEmpty5()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty();
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void DefaultIfEmpty6()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(24);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void DefaultIfEmpty7()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex).DefaultIfEmpty();
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void DefaultIfEmpty8()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex).DefaultIfEmpty(24);
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task DefaultIfEmpty9()
-        {
-            var xs = AsyncEnumerable.Empty<int>().DefaultIfEmpty(42);
-
-            var res = new[] { 42 };
-
-            Assert.True(res.SequenceEqual(await xs.ToArray()));
-        }
-
-        [Fact]
-        public async Task DefaultIfEmpty10()
-        {
-            var xs = AsyncEnumerable.Empty<int>().DefaultIfEmpty(42);
-
-            var res = new List<int> { 42 };
-
-            Assert.True(res.SequenceEqual(await xs.ToList()));
-        }
-
-        [Fact]
-        public async Task DefaultIfEmpty11()
-        {
-            var xs = AsyncEnumerable.Empty<int>().DefaultIfEmpty(42);
-
-            Assert.Equal(1, await xs.Count());
-        }
-
-
-        [Fact]
-        public async Task DefaultIfEmpty12()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(24);
-
-            var res = new[] { 1, 2, 3, 4 };
-
-            Assert.True(res.SequenceEqual(await xs.ToArray()));
-        }
-
-        [Fact]
-        public async Task DefaultIfEmpty13()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(24);
-
-            var res = new List<int> { 1, 2, 3, 4 };
-
-            Assert.True(res.SequenceEqual(await xs.ToList()));
-        }
-
-        [Fact]
-        public async Task DefaultIfEmpty14()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(24);
-
-            Assert.Equal(4, await xs.Count());
-        }
-
-        [Fact]
-        public async Task DefaultIfEmpty15()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(24);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public async Task DefaultIfEmpty16()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10)
-                .Take(5)
-                .Reverse() // so we have an ilist provider 
-                .DefaultIfEmpty(24)
-                .Append(5); // for the onlyIsCheap to true
-
-            var r = new[] { 4, 3, 2, 1, 0, 5 };
-
-            Assert.Equal(r, await xs.ToArray());
-        }
-
-        [Fact]
-        public async Task DefaultIfEmpty17()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10)
-                .Take(5)
-                .DefaultIfEmpty(24)
-                .Append(5); // for the onlyIsCheap to true
-
-            var r = new[] { 0, 1, 2, 3, 4, 5 };
-
-            Assert.Equal(r, await xs.ToArray());
-        }
-
-
-        [Fact]
-        public void Distinct_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct<int>(null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct<int>(null, new Eq()));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct<int>(AsyncEnumerable.Return(42), null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct<int, int>(AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void Distinct1()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct();
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 5);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Distinct2()
-        {
-            var xs = new[] { 1, -2, -1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(new Eq());
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, -2);
-            HasNext(e, 3);
-            HasNext(e, 5);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task Distinct3()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct();
-
-            var res = new[] { 1, 2, 3, 5, 4 };
-            Assert.True(res.SequenceEqual(await xs.ToArray()));
-        }
-
-        [Fact]
-        public async Task Distinct4()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct();
-
-            var res = new List<int> { 1, 2, 3, 5, 4 };
-            Assert.True(res.SequenceEqual(await xs.ToList()));
-        }
-
-        [Fact]
-        public async Task Distinct5()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct();
-
-            Assert.Equal(5, await xs.Count());
-        }
-
-        [Fact]
-        public async Task Distinct6()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(k => k);
-
-            var res = new[] { 1, 2, 3, 5, 4 };
-            Assert.True(res.SequenceEqual(await xs.ToArray()));
-        }
-
-        [Fact]
-        public async Task Distinct7()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(k => k);
-
-            var res = new List<int> { 1, 2, 3, 5, 4 };
-            Assert.True(res.SequenceEqual(await xs.ToList()));
-        }
-
-        [Fact]
-        public async Task Distinct8()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(k => k);
-
-            Assert.Equal(5, await xs.Count());
-        }
-
-        [Fact]
-        public async Task Distinct9()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(k => k);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public async Task Distinct10()
-        {
-            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct();
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void Distinct11()
-        {
-            var xs = AsyncEnumerable.Empty<int>().Distinct(k => k);
-
-            var e = xs.GetEnumerator();
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Distinct12()
-        {
-            var xs = AsyncEnumerable.Empty<int>().Distinct();
-
-            var e = xs.GetEnumerator();
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Reverse_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Reverse<int>(null));
-        }
-
-        [Fact]
-        public void Reverse1()
-        {
-            var xs = AsyncEnumerable.Empty<int>();
-            var ys = xs.Reverse();
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Reverse2()
-        {
-            var xs = AsyncEnumerable.Return(42);
-            var ys = xs.Reverse();
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 42);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Reverse3()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.Reverse();
-
-            var e = ys.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 2);
-            HasNext(e, 1);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Reverse4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.Reverse();
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Reverse5()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.Reverse();
-
-            Assert.Equal(new[] { 3, 2, 1 }, await ys.ToArray());
-        }
-
-        [Fact]
-        public async Task Reverse6()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.Reverse();
-
-            Assert.Equal(new[] { 3, 2, 1 }, await ys.ToList());
-        }
-
-        [Fact]
-        public async Task Reverse7()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.Reverse();
-
-            Assert.Equal(3, await ys.Count());
-        }
-
-        [Fact]
-        public async Task Reverse8()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.Reverse();
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task Reverse9()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.Reverse().Prepend(4); // to trigger onlyIfCheap
-
-            Assert.Equal(new[] { 4, 3, 2, 1 }, await ys.ToArray());
-        }
-
-        [Fact]
-        public async Task Reverse10()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10).Skip(1).Take(3);
-            var ys = xs.Reverse().Prepend(4); // to trigger onlyIfCheap
-
-            Assert.Equal(new[] { 4, 3, 2, 1 }, await ys.ToArray());
-        }
-
-        [Fact]
-        public async Task Reverse11()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10).Skip(1).Take(3);
-            var ys = xs.Reverse().Prepend(4); // to trigger onlyIfCheap
-
-            Assert.Equal(new[] { 4, 3, 2, 1 }, await ys.ToList());
-        }
-
-
-        [Fact]
-        public async Task Reverse12()
-        {
-            var xs = new CancellationTestAsyncEnumerable(10).Skip(1).Take(3);
-            var ys = xs.Reverse().Prepend(4).Prepend(5); // to trigger onlyIfCheap
-
-            Assert.Equal(new[] { 5, 4, 3, 2, 1 }, await ys.ToArray());
-        }
-
-
-        [Fact]
-        public void OrderBy_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderBy<int, int>(null, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderBy<int, int>(AsyncEnumerable.Return(42), null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderBy<int, int>(null, x => x, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderBy<int, int>(AsyncEnumerable.Return(42), null, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderBy<int, int>(AsyncEnumerable.Return(42), x => x, null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderByDescending<int, int>(null, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderByDescending<int, int>(AsyncEnumerable.Return(42), null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderByDescending<int, int>(null, x => x, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderByDescending<int, int>(AsyncEnumerable.Return(42), null, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OrderByDescending<int, int>(AsyncEnumerable.Return(42), x => x, null));
-
-            var xs = AsyncEnumerable.Return(42).OrderBy(x => x);
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenBy<int, int>(null, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenBy<int, int>(xs, null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenBy<int, int>(null, x => x, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenBy<int, int>(xs, null, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenBy<int, int>(xs, x => x, null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenByDescending<int, int>(null, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenByDescending<int, int>(xs, null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenByDescending<int, int>(null, x => x, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenByDescending<int, int>(xs, null, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.ThenByDescending<int, int>(xs, x => x, null));
-        }
-
-        [Fact]
-        public void OrderBy1()
-        {
-            var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable();
-            var ys = xs.OrderBy(x => x);
-
-            var e = ys.GetEnumerator();
-            for (var i = 0; i < 10; i++)
-            {
-                HasNext(e, i);
-            }
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void OrderBy2()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable();
-            var ys = xs.OrderBy<int, int>(x => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task OrderBy3()
-        {
-            var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable();
-            var ys = xs.OrderBy(x => x);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public void ThenBy2()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable();
-            var ys = xs.OrderBy(x => x).ThenBy<int, int>(x => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void OrderByDescending1()
-        {
-            var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable();
-            var ys = xs.OrderByDescending(x => x);
-
-            var e = ys.GetEnumerator();
-            for (var i = 9; i >= 0; i--)
-            {
-                HasNext(e, i);
-            }
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void OrderByDescending2()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable();
-            var ys = xs.OrderByDescending<int, int>(x => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task OrderByDescending3()
-        {
-            var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable();
-            var ys = xs.OrderByDescending(x => x);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public void ThenByDescending2()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable();
-            var ys = xs.OrderBy<int, int>(x => x).ThenByDescending<int, int>(x => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void OrderByThenBy1()
-        {
-            var xs = new[] {
-                new { Name = "Bart", Age = 27 },
-                new { Name = "John", Age = 62 },
-                new { Name = "Eric", Age = 27 },
-                new { Name = "Lisa", Age = 14 },
-                new { Name = "Brad", Age = 27 },
-                new { Name = "Lisa", Age = 23 },
-                new { Name = "Eric", Age = 42 },
-            };
-
-            var ys = xs.ToAsyncEnumerable();
-
-            var ress = xs.OrderBy(x => x.Name).ThenBy(x => x.Age);
-            var resa = ys.OrderBy(x => x.Name).ThenBy(x => x.Age);
-
-            Assert.True(ress.SequenceEqual(resa.ToEnumerable()));
-        }
-
-        [Fact]
-        public void OrderByThenBy2()
-        {
-            var xs = new[] {
-                new { Name = "Bart", Age = 27 },
-                new { Name = "John", Age = 62 },
-                new { Name = "Eric", Age = 27 },
-                new { Name = "Lisa", Age = 14 },
-                new { Name = "Brad", Age = 27 },
-                new { Name = "Lisa", Age = 23 },
-                new { Name = "Eric", Age = 42 },
-            };
-
-            var ys = xs.ToAsyncEnumerable();
-
-            var ress = xs.OrderBy(x => x.Name).ThenByDescending(x => x.Age);
-            var resa = ys.OrderBy(x => x.Name).ThenByDescending(x => x.Age);
-
-            Assert.True(ress.SequenceEqual(resa.ToEnumerable()));
-        }
-
-        [Fact]
-        public void OrderByThenBy3()
-        {
-            var xs = new[] {
-                new { Name = "Bart", Age = 27 },
-                new { Name = "John", Age = 62 },
-                new { Name = "Eric", Age = 27 },
-                new { Name = "Lisa", Age = 14 },
-                new { Name = "Brad", Age = 27 },
-                new { Name = "Lisa", Age = 23 },
-                new { Name = "Eric", Age = 42 },
-            };
-
-            var ys = xs.ToAsyncEnumerable();
-
-            var ress = xs.OrderByDescending(x => x.Name).ThenBy(x => x.Age);
-            var resa = ys.OrderByDescending(x => x.Name).ThenBy(x => x.Age);
-
-            Assert.True(ress.SequenceEqual(resa.ToEnumerable()));
-        }
-
-        [Fact]
-        public void OrderByThenBy4()
-        {
-            var xs = new[] {
-                new { Name = "Bart", Age = 27 },
-                new { Name = "John", Age = 62 },
-                new { Name = "Eric", Age = 27 },
-                new { Name = "Lisa", Age = 14 },
-                new { Name = "Brad", Age = 27 },
-                new { Name = "Lisa", Age = 23 },
-                new { Name = "Eric", Age = 42 },
-            };
-
-            var ys = xs.ToAsyncEnumerable();
-
-            var ress = xs.OrderByDescending(x => x.Name).ThenByDescending(x => x.Age);
-            var resa = ys.OrderByDescending(x => x.Name).ThenByDescending(x => x.Age);
-
-            Assert.True(ress.SequenceEqual(resa.ToEnumerable()));
-        }
-
-        [Fact]
-        public void GroupBy_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int>(null, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int>(AsyncEnumerable.Return(42), default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int>(null, x => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int>(AsyncEnumerable.Return(42), default, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int>(AsyncEnumerable.Return(42), x => x, default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(null, x => x, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), default, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), x => x, default(Func<int, int>)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(null, x => x, x => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), default, x => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), x => x, default(Func<int, int>), EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), x => x, x => x, default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(null, x => x, (x, ys) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), default, (x, ys) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), x => x, default(Func<int, IAsyncEnumerable<int>, int>)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(null, x => x, (x, ys) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), default, (x, ys) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), x => x, default(Func<int, IAsyncEnumerable<int>, int>), EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int>(AsyncEnumerable.Return(42), x => x, (x, ys) => x, default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(null, x => x, x => x, (x, ys) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(AsyncEnumerable.Return(42), default, x => x, (x, ys) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(AsyncEnumerable.Return(42), x => x, default, (x, ys) => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(AsyncEnumerable.Return(42), x => x, x => x, default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(null, x => x, x => x, (x, ys) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(AsyncEnumerable.Return(42), default, x => x, (x, ys) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(AsyncEnumerable.Return(42), x => x, default, (x, ys) => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(AsyncEnumerable.Return(42), x => x, x => x, default, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.GroupBy<int, int, int, int>(AsyncEnumerable.Return(42), x => x, x => x, (x, ys) => x, default));
-        }
-
-        [Fact]
-        public void GroupBy1()
-        {
-            var xs = new[] {
-                new { Name = "Bart", Age = 27 },
-                new { Name = "John", Age = 62 },
-                new { Name = "Eric", Age = 27 },
-                new { Name = "Lisa", Age = 14 },
-                new { Name = "Brad", Age = 27 },
-                new { Name = "Lisa", Age = 23 },
-                new { Name = "Eric", Age = 42 },
-            };
-
-            var ys = xs.ToAsyncEnumerable();
-
-            var res = ys.GroupBy(x => x.Age / 10);
-
-            var e = res.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            Assert.Equal(2, e.Current.Key);
-            var g1 = e.Current.GetEnumerator();
-            HasNext(g1, xs[0]);
-            HasNext(g1, xs[2]);
-            HasNext(g1, xs[4]);
-            HasNext(g1, xs[5]);
-            NoNext(g1);
-
-            Assert.True(e.MoveNext().Result);
-            Assert.Equal(6, e.Current.Key);
-            var g2 = e.Current.GetEnumerator();
-            HasNext(g2, xs[1]);
-            NoNext(g2);
-
-            Assert.True(e.MoveNext().Result);
-            Assert.Equal(1, e.Current.Key);
-            var g3 = e.Current.GetEnumerator();
-            HasNext(g3, xs[3]);
-            NoNext(g3);
-
-            Assert.True(e.MoveNext().Result);
-            Assert.Equal(4, e.Current.Key);
-            var g4 = e.Current.GetEnumerator();
-            HasNext(g4, xs[6]);
-            NoNext(g4);
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy2()
-        {
-            var xs = new[] {
-                new { Name = "Bart", Age = 27 },
-                new { Name = "John", Age = 62 },
-                new { Name = "Eric", Age = 27 },
-                new { Name = "Lisa", Age = 14 },
-                new { Name = "Brad", Age = 27 },
-                new { Name = "Lisa", Age = 23 },
-                new { Name = "Eric", Age = 42 },
-            };
-
-            var ys = xs.ToAsyncEnumerable();
-
-            var res = ys.GroupBy(x => x.Age / 10);
-
-            var e = res.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            var g1 = e.Current;
-            Assert.Equal(2, g1.Key);
-
-            Assert.True(e.MoveNext().Result);
-            var g2 = e.Current;
-            Assert.Equal(6, g2.Key);
-
-            Assert.True(e.MoveNext().Result);
-            var g3 = e.Current;
-            Assert.Equal(1, g3.Key);
-
-            Assert.True(e.MoveNext().Result);
-            var g4 = e.Current;
-            Assert.Equal(4, g4.Key);
-
-            NoNext(e);
-
-            var g1e = g1.GetEnumerator();
-            HasNext(g1e, xs[0]);
-            HasNext(g1e, xs[2]);
-            HasNext(g1e, xs[4]);
-            HasNext(g1e, xs[5]);
-            NoNext(g1e);
-
-            var g2e = g2.GetEnumerator();
-            HasNext(g2e, xs[1]);
-            NoNext(g2e);
-
-            var g3e = g3.GetEnumerator();
-            HasNext(g3e, xs[3]);
-            NoNext(g3e);
-
-            var g4e = g4.GetEnumerator();
-            HasNext(g4e, xs[6]);
-            NoNext(g4e);
-        }
-
-        [Fact]
-        public void GroupBy3()
-        {
-            var xs = AsyncEnumerable.Empty<int>();
-            var ys = xs.GroupBy(x => x);
-
-            var e = ys.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
-            var ys = xs.GroupBy(x => x);
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void GroupBy5()
-        {
-            var xs = GetXs().ToAsyncEnumerable();
-            var ys = xs.GroupBy(x => x);
-
-            var e = ys.GetEnumerator();
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!");
-
-            //Assert.True(e.MoveNext().Result);
-            //var g1 = e.Current;
-            //Assert.Equal(g1.Key, 42);
-            //var g1e = g1.GetEnumerator();
-            //HasNext(g1e, 42);
-
-            //Assert.True(e.MoveNext().Result);
-            //var g2 = e.Current;
-            //Assert.Equal(g2.Key, 43);
-            //var g2e = g2.GetEnumerator();
-            //HasNext(g2e, 43);
-
-
-            //AssertThrows<Exception>(() => g1e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!");
-            //AssertThrows<Exception>(() => g2e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!");
-        }
-
-        [Fact]
-        public void GroupBy6()
-        {
-            var xs = GetXs().ToAsyncEnumerable();
-            var ys = xs.GroupBy(x => x);
-
-            var e = ys.GetEnumerator();
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!");
-
-            //Assert.True(e.MoveNext().Result);
-            //var g1 = e.Current;
-            //Assert.Equal(g1.Key, 42);
-            //var g1e = g1.GetEnumerator();
-            //HasNext(g1e, 42);
-            //AssertThrows<Exception>(() => g1e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!");
-
-
-        }
-
-        private static IEnumerable<int> GetXs()
-        {
-            yield return 42;
-            yield return 43;
-            throw new Exception("Bang!");
-        }
-
-        [Fact]
-        public void GroupBy7()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Return(42);
-            var ys = xs.GroupBy<int, int>(x => { throw ex; });
-
-            var e = ys.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void GroupBy8()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
-            var ys = xs.GroupBy<int, int>(x => { if (x == 3) { throw ex; } return x; });
-
-            var e = ys.GetEnumerator();
-
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-
-            //Assert.True(e.MoveNext().Result);
-            //var g1 = e.Current;
-            //Assert.Equal(g1.Key, 1);
-            //var g1e = g1.GetEnumerator();
-            //HasNext(g1e, 1);
-
-            //Assert.True(e.MoveNext().Result);
-            //var g2 = e.Current;
-            //Assert.Equal(g2.Key, 2);
-            //var g2e = g2.GetEnumerator();
-            //HasNext(g2e, 2);
-
-
-            //AssertThrows<Exception>(() => g1e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-            //AssertThrows<Exception>(() => g2e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void GroupBy9()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x));
-
-            var e = ys.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            var g1 = e.Current;
-            Assert.Equal(0, g1.Key);
-            var g1e = g1.GetEnumerator();
-            HasNext(g1e, 'a');
-            HasNext(g1e, 'd');
-            HasNext(g1e, 'g');
-            HasNext(g1e, 'j');
-            NoNext(g1e);
-
-            Assert.True(e.MoveNext().Result);
-            var g2 = e.Current;
-            Assert.Equal(1, g2.Key);
-            var g2e = g2.GetEnumerator();
-            HasNext(g2e, 'b');
-            HasNext(g2e, 'e');
-            HasNext(g2e, 'h');
-            NoNext(g2e);
-
-            Assert.True(e.MoveNext().Result);
-            var g3 = e.Current;
-            Assert.Equal(2, g3.Key);
-            var g3e = g3.GetEnumerator();
-            HasNext(g3e, 'c');
-            HasNext(g3e, 'f');
-            HasNext(g3e, 'i');
-            NoNext(g3e);
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy10()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, "0 - adgj");
-            HasNext(e, "1 - beh");
-            HasNext(e, "2 - cfi");
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy11()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result);
-
-            var e = ys.GetEnumerator();
-            HasNext(e, "0 - 0369");
-            HasNext(e, "1 - 147");
-            HasNext(e, "2 - 258");
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy12()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, new EqMod(3));
-
-            var e = ys.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            var g1 = e.Current;
-            Assert.Equal(0, g1.Key);
-            var g1e = g1.GetEnumerator();
-            HasNext(g1e, 0);
-            HasNext(g1e, 3);
-            HasNext(g1e, 6);
-            HasNext(g1e, 9);
-            NoNext(g1e);
-
-            Assert.True(e.MoveNext().Result);
-            var g2 = e.Current;
-            Assert.Equal(1, g2.Key);
-            var g2e = g2.GetEnumerator();
-            HasNext(g2e, 1);
-            HasNext(g2e, 4);
-            HasNext(g2e, 7);
-            NoNext(g2e);
-
-            Assert.True(e.MoveNext().Result);
-            var g3 = e.Current;
-            Assert.Equal(2, g3.Key);
-            var g3e = g3.GetEnumerator();
-            HasNext(g3e, 2);
-            HasNext(g3e, 5);
-            HasNext(g3e, 8);
-            NoNext(g3e);
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy13()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3));
-
-            var e = ys.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            var g1 = e.Current;
-            Assert.Equal(0, g1.Key);
-            var g1e = g1.GetEnumerator();
-            HasNext(g1e, 'a');
-            HasNext(g1e, 'd');
-            HasNext(g1e, 'g');
-            HasNext(g1e, 'j');
-            NoNext(g1e);
-
-            Assert.True(e.MoveNext().Result);
-            var g2 = e.Current;
-            Assert.Equal(1, g2.Key);
-            var g2e = g2.GetEnumerator();
-            HasNext(g2e, 'b');
-            HasNext(g2e, 'e');
-            HasNext(g2e, 'h');
-            NoNext(g2e);
-
-            Assert.True(e.MoveNext().Result);
-            var g3 = e.Current;
-            Assert.Equal(2, g3.Key);
-            var g3e = g3.GetEnumerator();
-            HasNext(g3e, 'c');
-            HasNext(g3e, 'f');
-            HasNext(g3e, 'i');
-            NoNext(g3e);
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy14()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3));
-
-            var e = ys.GetEnumerator();
-            HasNext(e, "0 - adgj");
-            HasNext(e, "1 - beh");
-            HasNext(e, "2 - cfi");
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy15()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3));
-
-            var e = ys.GetEnumerator();
-            HasNext(e, "0 - 0369");
-            HasNext(e, "1 - 147");
-            HasNext(e, "2 - 258");
-            NoNext(e);
-        }
-
-        [Fact]
-        public void GroupBy16()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3));
-
-            var e = ys.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            var g1 = e.Current;
-            Assert.Equal(0, g1.Key);
-            var g1e = g1.GetEnumerator();
-            HasNext(g1e, 'a');
-            HasNext(g1e, 'd');
-            HasNext(g1e, 'g');
-            HasNext(g1e, 'j');
-            NoNext(g1e);
-            g1e.Dispose();
-
-            Assert.True(e.MoveNext().Result);
-            var g2 = e.Current;
-            Assert.Equal(1, g2.Key);
-            var g2e = g2.GetEnumerator();
-            HasNext(g2e, 'b');
-            HasNext(g2e, 'e');
-            HasNext(g2e, 'h');
-            NoNext(g2e);
-            g2e.Dispose();
-
-            Assert.True(e.MoveNext().Result);
-            var g3 = e.Current;
-            Assert.Equal(2, g3.Key);
-            var g3e = g3.GetEnumerator();
-            HasNext(g3e, 'c');
-            HasNext(g3e, 'f');
-            HasNext(g3e, 'i');
-            NoNext(g3e);
-            g3e.Dispose();
-
-            NoNext(e);
-
-            e.Dispose();
-        }
-
-        [Fact]
-        public void GroupBy17()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3));
-
-            var e = ys.GetEnumerator();
-            e.Dispose();
-
-            Assert.False(e.MoveNext().Result);
-        }
-
-        [Fact]
-        public void GroupBy18()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3));
-
-            var e = ys.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            var g1 = e.Current;
-            Assert.Equal(0, g1.Key);
-            var g1e = g1.GetEnumerator();
-            HasNext(g1e, 'a');
-
-            e.Dispose();
-
-            HasNext(g1e, 'd');
-            HasNext(g1e, 'g');
-            HasNext(g1e, 'j');
-            NoNext(g1e);
-            g1e.Dispose();
-
-            Assert.False(e.MoveNext().Result);
-        }
-
-        [Fact]
-        public async Task GroupBy19()
-        {
-            // We're using Kvp here because the types will eval as equal for this test
-            var xs = new[]
-            {
-                new Kvp("Bart", 27),
-                new Kvp("John", 62),
-                new Kvp("Eric", 27),
-                new Kvp("Lisa", 14),
-                new Kvp("Brad", 27),
-                new Kvp("Lisa", 23),
-                new Kvp("Eric", 42)
-            };
-
-            var ys = xs.ToAsyncEnumerable();
-
-            var res = ys.GroupBy(x => x.Item / 10);
-
-            await SequenceIdentity(res);
-        }
-
-
-        [Fact]
-        public async Task GroupBy20()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result);
-
-            var arr = new[] { "0 - adgj", "1 - beh", "2 - cfi" };
-
-            Assert.Equal(arr, await ys.ToArray());
-        }
-
-        [Fact]
-        public async Task GroupBy21()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result);
-
-            var arr = new List<string> { "0 - adgj", "1 - beh", "2 - cfi" };
-
-            Assert.Equal(arr, await ys.ToList());
-        }
-
-        [Fact]
-        public async Task GroupBy22()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result);
-
-            Assert.Equal(3, await ys.Count());
-        }
-
-        [Fact]
-        public async Task GroupBy23()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result);
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task GroupBy24()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x));
-
-            var g1a = new[] { 'a', 'd', 'g', 'j' };
-            var g2a = new[] { 'b', 'e', 'h' };
-            var g3a = new[] { 'c', 'f', 'i' };
-
-            var gar = await ys.ToArray();
-
-            Assert.Equal(3, gar.Length);
-
-            var gg1 = gar[0];
-            var gg1a = await gg1.ToArray();
-
-            Assert.Equal(g1a, gg1a);
-
-            var gg2 = gar[1];
-            var gg2a = await gg2.ToArray();
-
-            Assert.Equal(g2a, gg2a);
-
-            var gg3 = gar[2];
-            var gg3a = await gg3.ToArray();
-            Assert.Equal(g3a, gg3a);
-        }
-
-        [Fact]
-        public async Task GroupBy25()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x));
-
-            var g1a = new List<char> { 'a', 'd', 'g', 'j' };
-            var g2a = new List<char> { 'b', 'e', 'h' };
-            var g3a = new List<char> { 'c', 'f', 'i' };
-
-            var gar = await ys.ToList();
-
-            Assert.Equal(3, gar.Count);
-
-            var gg1 = gar[0];
-            var gg1a = await gg1.ToList();
-            Assert.Equal(g1a, gg1a);
-
-            var gg2 = gar[1];
-            var gg2a = await gg2.ToList();
-            Assert.Equal(g2a, gg2a);
-
-            var gg3 = gar[2];
-            var gg3a = await gg3.ToList();
-            Assert.Equal(g3a, gg3a);
-        }
-
-        [Fact]
-        public async Task GroupBy26()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x));
-
-            var gar = await ys.ToList();
-
-            Assert.Equal(3, gar.Count);
-
-            var gg1 = gar[0];
-            var gg1a = await gg1.Count();
-            Assert.Equal(4, gg1a);
-
-            var gg2 = gar[1];
-            var gg2a = await gg2.Count();
-            Assert.Equal(3, gg2a);
-
-            var gg3 = gar[2];
-            var gg3a = await gg3.Count();
-            Assert.Equal(3, gg3a);
-        }
-
-        [Fact]
-        public async Task GroupBy27()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x));
-
-            var gar = await ys.Count();
-
-            Assert.Equal(3, gar);
-        }
-
-        [Fact]
-        public async Task GroupBy28()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x));
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task GroupBy29()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, new EqMod(3));
-
-            var g1a = new List<int> { 0, 3, 6, 9 };
-            var g2a = new List<int> { 1, 4, 7 };
-            var g3a = new List<int> { 2, 5, 8 };
-
-            var gar = await ys.ToList();
-
-            Assert.Equal(3, gar.Count);
-
-            var gg1 = gar[0];
-            var gg1a = await gg1.ToList();
-            Assert.Equal(g1a, gg1a);
-
-            var gg2 = gar[1];
-            var gg2a = await gg2.ToList();
-            Assert.Equal(g2a, gg2a);
-
-            var gg3 = gar[2];
-            var gg3a = await gg3.ToList();
-            Assert.Equal(g3a, gg3a);
-        }
-
-        [Fact]
-        public async Task GroupBy30()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, new EqMod(3));
-
-
-            var gar = await ys.ToList();
-
-            Assert.Equal(3, gar.Count);
-
-            var gg1 = gar[0];
-            var gg1a = await gg1.Count();
-            Assert.Equal(4, gg1a);
-
-            var gg2 = gar[1];
-            var gg2a = await gg2.Count();
-            Assert.Equal(3, gg2a);
-
-            var gg3 = gar[2];
-            var gg3a = await gg3.Count();
-            Assert.Equal(3, gg3a);
-        }
-
-        [Fact]
-        public async Task GroupBy31()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, new EqMod(3));
-
-            var g1a = new[] { 0, 3, 6, 9 };
-            var g2a = new[] { 1, 4, 7 };
-            var g3a = new[] { 2, 5, 8 };
-
-            var gar = await ys.ToArray();
-
-            Assert.Equal(3, gar.Length);
-
-            var gg1 = gar[0];
-            var gg1a = await gg1.ToArray();
-
-            Assert.Equal(g1a, gg1a);
-
-            var gg2 = gar[1];
-            var gg2a = await gg2.ToArray();
-
-            Assert.Equal(g2a, gg2a);
-
-            var gg3 = gar[2];
-            var gg3a = await gg3.ToArray();
-            Assert.Equal(g3a, gg3a);
-        }
-
-        [Fact]
-        public async Task GroupBy32()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, new EqMod(3));
-
-            var gar = await ys.Count();
-
-            Assert.Equal(3, gar);
-        }
-
-        [Fact]
-        public async Task GroupBy33()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, new EqMod(3));
-
-            await SequenceIdentity(ys);
-        }
-
-        [Fact]
-        public async Task GroupBy34()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3));
-
-            var arr = new[] { "0 - 0369", "1 - 147", "2 - 258" };
-
-            Assert.Equal(arr, await ys.ToArray());
-        }
-
-        [Fact]
-        public async Task GroupBy35()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3));
-
-            var arr = new List<string> { "0 - 0369", "1 - 147", "2 - 258" };
-
-            Assert.Equal(arr, await ys.ToList());
-        }
-
-        [Fact]
-        public async Task GroupBy36()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3));
-
-            Assert.Equal(3, await ys.Count());
-        }
-
-        [Fact]
-        public async Task GroupBy37()
-        {
-            var xs = AsyncEnumerable.Range(0, 10);
-            var ys = xs.GroupBy(x => x, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3));
-
-            await SequenceIdentity(ys);
-        }
-
-        private class Kvp : IEquatable<Kvp>
-        {
-            public bool Equals(Kvp other)
-            {
-                if (other is null)
-                {
-                    return false;
-                }
-
-                if (ReferenceEquals(this, other))
-                {
-                    return true;
-                }
-
-                return string.Equals(Key, other.Key) && Item == other.Item;
-            }
-
-            public override bool Equals(object obj)
-            {
-                if (obj is null)
-                {
-                    return false;
-                }
-
-                if (ReferenceEquals(this, obj))
-                {
-                    return true;
-                }
-
-                if (obj.GetType() != GetType())
-                {
-                    return false;
-                }
-
-                return Equals((Kvp)obj);
-            }
-
-            public override int GetHashCode()
-            {
-                unchecked
-                {
-                    return ((Key != null ? Key.GetHashCode() : 0) * 397) ^ Item;
-                }
-            }
-
-            public static bool operator ==(Kvp left, Kvp right)
-            {
-                return Equals(left, right);
-            }
-
-            public static bool operator !=(Kvp left, Kvp right)
-            {
-                return !Equals(left, right);
-            }
-
-
-            public string Key { get; }
-            public int Item { get; }
-
-            public Kvp(string key, int item)
-            {
-                Key = key;
-                Item = item;
-            }
-        }
-
-        private class EqMod : IEqualityComparer<int>
-        {
-            private readonly int _d;
-
-            public EqMod(int d)
-            {
-                _d = d;
-            }
-
-            public bool Equals(int x, int y)
-            {
-                return EqualityComparer<int>.Default.Equals(x % _d, y % _d);
-            }
-
-            public int GetHashCode(int obj)
-            {
-                return EqualityComparer<int>.Default.GetHashCode(obj % _d);
-            }
-        }
-
-        [Fact]
-        public void AsAsyncEnumerable_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.AsAsyncEnumerable<int>(null));
-        }
-
-        [Fact]
-        public void AsAsyncEnumerable1()
-        {
-            var xs = AsyncEnumerable.Return(42);
-            var ys = xs.AsAsyncEnumerable();
-
-            Assert.NotSame(xs, ys);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 42);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void RepeatSeq_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Repeat(default(IAsyncEnumerable<int>)));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Repeat(default(IAsyncEnumerable<int>), 3));
-            AssertThrows<ArgumentOutOfRangeException>(() => AsyncEnumerable.Repeat(AsyncEnumerable.Return(42), -1));
-        }
-
-        [Fact]
-        public void RepeatSeq1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat();
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-        }
-
-        [Fact]
-        public void RepeatSeq2()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat(3);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void RepeatSeq3()
-        {
-            var i = 0;
-            var xs = RepeatXs(() => i++).ToAsyncEnumerable().Repeat(3);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-
-            Assert.Equal(3, i);
-        }
-
-        [Fact]
-        public void RepeatSeq0()
-        {
-            var i = 0;
-            var xs = RepeatXs(() => i++).ToAsyncEnumerable().Repeat(0);
-
-            var e = xs.GetEnumerator();
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task RepeatSeq6()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat(3);
-
-            await SequenceIdentity(xs);
-        }
-
-        private static IEnumerable<int> RepeatXs(Action started)
-        {
-            started();
-
-            yield return 1;
-            yield return 2;
-        }
-
-        [Fact]
-        public void RepeatSeq4()
-        {
-            var xs = new FailRepeat().ToAsyncEnumerable().Repeat();
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException);
-        }
-
-        [Fact]
-        public void RepeatSeq5()
-        {
-            var xs = new FailRepeat().ToAsyncEnumerable().Repeat(3);
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException);
-        }
-
-        private class FailRepeat : IEnumerable<int>
-        {
-            public IEnumerator<int> GetEnumerator()
-            {
-                throw new NotImplementedException();
-            }
-
-            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        [Fact]
-        public void IgnoreElements_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.IgnoreElements(default(IAsyncEnumerable<int>)));
-        }
-
-        [Fact]
-        public void IgnoreElements1()
-        {
-            var xs = AsyncEnumerable.Empty<int>().IgnoreElements();
-
-            var e = xs.GetEnumerator();
-            NoNext(e);
-
-            AssertThrows<InvalidOperationException>(() => { var ignored = e.Current; });
-        }
-
-        [Fact]
-        public void IgnoreElements2()
-        {
-            var xs = AsyncEnumerable.Return(42).IgnoreElements();
-
-            var e = xs.GetEnumerator();
-            NoNext(e);
-
-            AssertThrows<InvalidOperationException>(() => { var ignored = e.Current; });
-        }
-
-        [Fact]
-        public void IgnoreElements3()
-        {
-            var xs = AsyncEnumerable.Range(0, 10).IgnoreElements();
-
-            var e = xs.GetEnumerator();
-            NoNext(e);
-
-            AssertThrows<InvalidOperationException>(() => { var ignored = e.Current; });
-        }
-
-        [Fact]
-        public void IgnoreElements4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex).IgnoreElements();
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task IgnoreElements5()
-        {
-            var xs = AsyncEnumerable.Range(0, 10).IgnoreElements();
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void StartWith_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.StartWith(default, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.StartWith(AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void StartWith1()
-        {
-            var xs = AsyncEnumerable.Empty<int>().StartWith(1, 2);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void StartWith2()
-        {
-            var xs = AsyncEnumerable.Return<int>(0).StartWith(1, 2);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 0);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void StartWith3()
-        {
-            var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex).StartWith(1, 2);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Buffer_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Buffer(default(IAsyncEnumerable<int>), 1));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Buffer(default(IAsyncEnumerable<int>), 1, 1));
-
-            AssertThrows<ArgumentOutOfRangeException>(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), -1));
-            AssertThrows<ArgumentOutOfRangeException>(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), -1, 1));
-            AssertThrows<ArgumentOutOfRangeException>(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), 1, -1));
-        }
-
-        [Fact]
-        public void Buffer1()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(2);
-
-            var e = xs.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            Assert.True(e.Current.SequenceEqual(new[] { 1, 2 }));
-
-            Assert.True(e.MoveNext().Result);
-            Assert.True(e.Current.SequenceEqual(new[] { 3, 4 }));
-
-            Assert.True(e.MoveNext().Result);
-            Assert.True(e.Current.SequenceEqual(new[] { 5 }));
-
-            Assert.False(e.MoveNext().Result);
-        }
-
-        [Fact]
-        public void Buffer2()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(3, 2);
-
-            var e = xs.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            Assert.True(e.Current.SequenceEqual(new[] { 1, 2, 3 }));
-
-            Assert.True(e.MoveNext().Result);
-            Assert.True(e.Current.SequenceEqual(new[] { 3, 4, 5 }));
-
-            Assert.True(e.MoveNext().Result);
-            Assert.True(e.Current.SequenceEqual(new[] { 5 }));
-
-            Assert.False(e.MoveNext().Result);
-        }
-
-        [Fact]
-        public void Buffer3()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(2, 3);
-
-            var e = xs.GetEnumerator();
-
-            Assert.True(e.MoveNext().Result);
-            Assert.True(e.Current.SequenceEqual(new[] { 1, 2 }));
-
-            Assert.True(e.MoveNext().Result);
-            Assert.True(e.Current.SequenceEqual(new[] { 4, 5 }));
-
-            Assert.False(e.MoveNext().Result);
-        }
-
-        [Fact]
-        public async Task Buffer4()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(3, 2);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void DistinctUntilChanged_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable<int>)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DistinctUntilChanged(default, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable<int>), x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default(Func<int, int>)));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable<int>), x => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), x => x, default));
-        }
-
-        [Fact]
-        public void DistinctUntilChanged1()
-        {
-            var xs = new[] { 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 7, 3, 2, 2, 1, 1 }.ToAsyncEnumerable().DistinctUntilChanged();
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            HasNext(e, 5);
-            HasNext(e, 6);
-            HasNext(e, 7);
-            HasNext(e, 3);
-            HasNext(e, 2);
-            HasNext(e, 1);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void DistinctUntilChanged2()
-        {
-            var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => (x + 1) / 2);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 3);
-            HasNext(e, 5);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void DistinctUntilChanged3()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => { if (x == 4) { throw ex; } return x; });
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task DistinctUntilChanged4()
-        {
-            var xs = new[] { 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 7, 3, 2, 2, 1, 1 }.ToAsyncEnumerable().DistinctUntilChanged();
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public async Task DistinctUntilChanged5()
-        {
-            var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => (x + 1) / 2);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void Expand_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Expand(default(IAsyncEnumerable<int>), x => null));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Expand(AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void Expand1()
-        {
-            var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => AsyncEnumerable.Return(x - 1).Repeat(x - 1));
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 2);
-            HasNext(e, 1);
-            HasNext(e, 1);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Expand2()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => { throw ex; });
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Expand3()
-        {
-            var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => null);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 2);
-            HasNext(e, 3);
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NullReferenceException);
-        }
-
-        [Fact]
-        public async Task Expand4()
-        {
-            var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => AsyncEnumerable.Return(x - 1).Repeat(x - 1));
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void Scan_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Scan(default(IAsyncEnumerable<int>), 3, (x, y) => x + y));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Scan(AsyncEnumerable.Return(42), 3, null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Scan(default(IAsyncEnumerable<int>), (x, y) => x + y));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Scan(AsyncEnumerable.Return(42), null));
-        }
-
-        [Fact]
-        public void Scan1()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => x + y);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 9);
-            HasNext(e, 11);
-            HasNext(e, 14);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Scan2()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => x + y);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 6);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Scan3()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => { throw ex; });
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public void Scan4()
-        {
-            var ex = new Exception("Bang!");
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => { throw ex; });
-
-            var e = xs.GetEnumerator();
-            AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
-        }
-
-        [Fact]
-        public async Task Scan5()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => x + y);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public async Task Scan6()
-        {
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => x + y);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void DistinctKey_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct(default(IAsyncEnumerable<int>), x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), null));
-
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct(default(IAsyncEnumerable<int>), x => x, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), null, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), x => x, null));
-        }
-
-        [Fact]
-        public void DistinctKey1()
-        {
-            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Distinct(x => x / 2);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeLast_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.TakeLast(default(IAsyncEnumerable<int>), 5));
-        }
-
-        [Fact]
-        public void TakeLast0()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(-2);
-
-            var e = xs.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeLast1()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(2);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void TakeLast2()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(5);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task TakeLast3()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(2);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void TakeLast_BugFix_TakeLast_Zero_TakesForever()
-        {
-            var isSet = false;
-            new int[] { 1, 2, 3, 4 }.ToAsyncEnumerable()
-                .TakeLast(0)
-                .ForEachAsync(_ => { isSet = true; })
-                .Wait(WaitTimeoutMs);
-
-            Assert.False(isSet);
-
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(0);
-
-            var e = xs.GetEnumerator();
-
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipLast_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.SkipLast(default(IAsyncEnumerable<int>), 5));
-        }
-
-        [Fact]
-        public void SkipLast1()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().SkipLast(2);
-
-            var e = xs.GetEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void SkipLast2()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().SkipLast(5);
-
-            var e = xs.GetEnumerator();
-            NoNext(e);
-        }
-
-        [Fact]
-        public async Task SkipLast3()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().SkipLast(2);
-
-            await SequenceIdentity(xs);
-        }
-
-        [Fact]
-        public void SkipLast4()
-        {
-            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().SkipLast(0);
-
-            var e = xs.GetEnumerator();
-
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-    }
-}

+ 3 - 49
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.cs

@@ -3,35 +3,22 @@
 // See the LICENSE file in the project root for more information. 
 
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using FluentAssertions;
 using Xunit;
 
-
 namespace Tests
 {
     public partial class AsyncTests
     {
-#pragma warning disable xUnit1013 // Public method should be marked as test        
+#pragma warning disable xUnit1013 // Public method should be marked as test
         public void AssertThrows<E>(Action a)
             where E : Exception
         {
             Assert.Throws<E>(a);
         }
 
-        [Obsolete("Don't use this, use Assert.ThrowsAsync and await it", true)]
-        public Task AssertThrows<E>(Func<Task> func)
-            where E : Exception
-        {
-            return Assert.ThrowsAsync<E>(func);
-        }
-
         public void AssertThrows<E>(Action a, Func<E, bool> assert)
             where E : Exception
         {
-
             var hasFailed = false;
 
             try
@@ -49,39 +36,6 @@ namespace Tests
                 Assert.True(false);
             }
         }
-
-        public void NoNext<T>(IAsyncEnumerator<T> e)
-        {
-            Assert.False(e.MoveNext().Result);
-        }
-
-        public void HasNext<T>(IAsyncEnumerator<T> e, T value)
-        {
-            Assert.True(e.MoveNext().Result);
-            Assert.Equal(value, e.Current);
-        }
-
-        public async Task SequenceIdentity<T>(IAsyncEnumerable<T> enumerable)
-        {
-            var en1 = enumerable.GetEnumerator();
-            var en2 = enumerable.GetEnumerator();
-
-            Assert.Equal(en1.GetType(), en2.GetType());
-
-            en1.Dispose();
-            en2.Dispose();
-
-            var e1t = enumerable.ToList();
-            var e2t = enumerable.ToList();
-
-            await Task.WhenAll(e1t, e2t);
-
-
-            var e1Result = e1t.Result;
-            var e2Result = e2t.Result;
-
-            e1Result.ShouldAllBeEquivalentTo(e2Result);
-        }
-#pragma warning restore xUnit1013 // Public method should be marked as test        
+#pragma warning restore xUnit1013 // Public method should be marked as test
     }
-}
+}

+ 30 - 7
Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>netcoreapp2.1;netcoreapp1.1;net461</TargetFrameworks>
+    <TargetFrameworks>netcoreapp2.1;net461;netcoreapp3.0</TargetFrameworks>
     <NoWarn>$(NoWarn);CS0618</NoWarn>
   </PropertyGroup>
 
@@ -14,21 +14,44 @@
 
   <ItemGroup>
     <ProjectReference Include="..\System.Interactive.Async.Providers\System.Interactive.Async.Providers.csproj" />
-    <ProjectReference Include="..\System.Interactive\System.Interactive.csproj" />
+    <ProjectReference Include="..\System.Linq.Async\System.Linq.Async.csproj" />
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0-preview-20180610-02" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0-beta.2.build4010" />
-    <PackageReference Include="FluentAssertions" Version="4.19.2 " />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0-preview-20190203-03" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="FluentAssertions" Version="5.6.0" />
 
-    <PackageReference Include="xunit" Version="2.4.0-beta.2.build4010" />
+    <PackageReference Include="xunit" Version="2.4.1" />
 
   </ItemGroup>
 
   <ItemGroup>
+    <Compile Include="..\System.Linq.Async.Tests\ValueTaskHelpers.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Update="AsyncQueryableExTests.Generated.tt">
+      <LastGenOutput>AsyncQueryableExTests.Generated.cs</LastGenOutput>
+      <Generator>TextTemplatingFileGenerator</Generator>
+    </None>
     <None Update="AsyncQueryableTests.Generated.tt" Generator="TextTemplatingFileGenerator" LastGenOutput="AsyncQueryableTests.Generated.cs" />
-    <Compile Update="AsyncQueryableTests.Generated.cs" DesignTime="True" AutoGen="True" DependentUpon="AsyncQueryableTests.Generated.tt" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Update="AsyncQueryableExTests.Generated.cs">
+      <DesignTime>True</DesignTime>
+      <AutoGen>True</AutoGen>
+      <DependentUpon>AsyncQueryableExTests.Generated.tt</DependentUpon>
+    </Compile>
+    <Compile Update="AsyncQueryableTests.Generated.cs">
+      <DesignTime>True</DesignTime>
+      <AutoGen>True</AutoGen>
+      <DependentUpon>AsyncQueryableTests.Generated.tt</DependentUpon>
+    </Compile>
   </ItemGroup>
 
 </Project>

+ 69 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/AsyncEnumerableExTests.cs

@@ -0,0 +1,69 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using FluentAssertions;
+using Xunit;
+
+namespace Tests
+{
+    public class AsyncEnumerableExTests
+    {
+        protected static readonly IAsyncEnumerable<int> Return42 = AsyncEnumerableEx.Return(42);
+        protected static IAsyncEnumerable<T> Throw<T>(Exception exception) => AsyncEnumerableEx.Throw<T>(exception);
+
+        protected async Task AssertThrowsAsync<TException>(Task t)
+            where TException : Exception
+        {
+            await Assert.ThrowsAsync<TException>(() => t);
+        }
+
+        protected async Task AssertThrowsAsync(Task t, Exception e)
+        {
+            try
+            {
+                await t;
+            }
+            catch (Exception ex)
+            {
+                Assert.Same(e, ex);
+            }
+        }
+
+        protected Task AssertThrowsAsync<T>(ValueTask<T> t, Exception e)
+        {
+            return AssertThrowsAsync(t.AsTask(), e);
+        }
+
+        protected async Task NoNextAsync<T>(IAsyncEnumerator<T> e)
+        {
+            Assert.False(await e.MoveNextAsync());
+        }
+
+        protected async Task HasNextAsync<T>(IAsyncEnumerator<T> e, T value)
+        {
+            Assert.True(await e.MoveNextAsync());
+            Assert.Equal(value, e.Current);
+        }
+
+        protected async Task SequenceIdentity<T>(IAsyncEnumerable<T> enumerable)
+        {
+            var en1 = enumerable.GetAsyncEnumerator();
+            var en2 = enumerable.GetAsyncEnumerator();
+
+            Assert.Equal(en1.GetType(), en2.GetType());
+
+            await en1.DisposeAsync();
+            await en2.DisposeAsync();
+
+            var res1 = await enumerable.ToListAsync();
+            var res2 = await enumerable.ToListAsync();
+
+            res1.Should().BeEquivalentTo(res2);
+        }
+    }
+}

+ 88 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Buffer.cs

@@ -0,0 +1,88 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Buffer : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Buffer_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Buffer(default(IAsyncEnumerable<int>), 1));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Buffer(default(IAsyncEnumerable<int>), 1, 1));
+
+            Assert.Throws<ArgumentOutOfRangeException>(() => AsyncEnumerableEx.Buffer(Return42, -1));
+            Assert.Throws<ArgumentOutOfRangeException>(() => AsyncEnumerableEx.Buffer(Return42, -1, 1));
+            Assert.Throws<ArgumentOutOfRangeException>(() => AsyncEnumerableEx.Buffer(Return42, 1, -1));
+        }
+
+        [Fact]
+        public async Task Buffer1Async()
+        {
+            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(2);
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.True(await e.MoveNextAsync());
+            Assert.True(e.Current.SequenceEqual(new[] { 1, 2 }));
+
+            Assert.True(await e.MoveNextAsync());
+            Assert.True(e.Current.SequenceEqual(new[] { 3, 4 }));
+
+            Assert.True(await e.MoveNextAsync());
+            Assert.True(e.Current.SequenceEqual(new[] { 5 }));
+
+            Assert.False(await e.MoveNextAsync());
+        }
+
+        [Fact]
+        public async Task Buffer2Async()
+        {
+            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(3, 2);
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.True(await e.MoveNextAsync());
+            Assert.True(e.Current.SequenceEqual(new[] { 1, 2, 3 }));
+
+            Assert.True(await e.MoveNextAsync());
+            Assert.True(e.Current.SequenceEqual(new[] { 3, 4, 5 }));
+
+            Assert.True(await e.MoveNextAsync());
+            Assert.True(e.Current.SequenceEqual(new[] { 5 }));
+
+            Assert.False(await e.MoveNextAsync());
+        }
+
+        [Fact]
+        public async Task Buffer3Async()
+        {
+            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(2, 3);
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.True(await e.MoveNextAsync());
+            Assert.True(e.Current.SequenceEqual(new[] { 1, 2 }));
+
+            Assert.True(await e.MoveNextAsync());
+            Assert.True(e.Current.SequenceEqual(new[] { 4, 5 }));
+
+            Assert.False(await e.MoveNextAsync());
+        }
+
+        [Fact]
+        public async Task Buffer4()
+        {
+            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(3, 2);
+
+            await SequenceIdentity(xs);
+        }
+    }
+}

+ 300 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Catch.cs

@@ -0,0 +1,300 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Catch : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Catch_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Catch<int, Exception>(default, x => default(IAsyncEnumerable<int>)));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Catch<int, Exception>(Return42, default(Func<Exception, IAsyncEnumerable<int>>)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Catch<int>(default, Return42));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Catch<int>(Return42, default));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Catch<int>(default));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Catch<int>(default(IEnumerable<IAsyncEnumerable<int>>)));
+        }
+
+        [Fact]
+        public async Task Catch1Async()
+        {
+            var err = false;
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = xs.Catch<int, Exception>(ex_ => { err = true; return ys; });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await NoNextAsync(e);
+
+            Assert.False(err);
+        }
+
+        [Fact]
+        public async Task Catch2Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var err = false;
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return ys; });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            Assert.False(err);
+
+            await HasNextAsync(e, 4);
+
+            Assert.True(err);
+
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Catch3Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var err = false;
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = xs.Catch<int, Exception>(ex_ => { err = true; return ys; });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            Assert.False(err);
+
+            await HasNextAsync(e, 4);
+
+            Assert.True(err);
+
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Catch4Async()
+        {
+            var ex = new DivideByZeroException();
+
+            var err = false;
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return ys; });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+
+            Assert.False(err);
+        }
+
+        [Fact]
+        public async Task Catch5Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+            var ex2 = new Exception("Oops!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = xs.Catch<int, InvalidOperationException>(ex_ => { if (ex_.Message == "Bang!") throw ex2; return ys; });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            await AssertThrowsAsync(e.MoveNextAsync(), ex2);
+        }
+
+        [Fact]
+        public async Task Catch6Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var err = false;
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+
+            var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return xs; });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            Assert.False(err);
+
+            await HasNextAsync(e, 1);
+
+            Assert.True(err);
+
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Catch7Async()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.Catch(xs, ys);
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Catch8Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.Catch(xs, ys);
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Catch9Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.Catch(new[] { xs, xs, ys, ys });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Catch10Async()
+        {
+            var ex = new Exception("Bang!");
+            var res = CatchXss(ex).Catch();
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        private IEnumerable<IAsyncEnumerable<int>> CatchXss(Exception ex)
+        {
+            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(new Exception("!!!")));
+            throw ex;
+        }
+
+        [Fact]
+        public async Task Catch11Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+
+            var res = AsyncEnumerableEx.Catch(new[] { xs, xs });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Catch12Async()
+        {
+            var res = AsyncEnumerableEx.Catch(Enumerable.Empty<IAsyncEnumerable<int>>());
+
+            var e = res.GetAsyncEnumerator();
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Catch13()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.Catch(new[] { xs, xs, ys, ys });
+
+            await SequenceIdentity(res);
+        }
+
+        [Fact]
+        public async Task Catch14()
+        {
+            var err = false;
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = xs.Catch<int, Exception>(ex_ => { err = true; return ys; });
+
+            await SequenceIdentity(res);
+
+            Assert.False(err);
+        }
+    }
+}

+ 96 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Concat.cs

@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Concat : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Concat_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Concat<int>(default(IAsyncEnumerable<int>[])));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Concat<int>(default(IEnumerable<IAsyncEnumerable<int>>)));
+        }
+
+        [Fact]
+        public async Task Concat4Async()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
+            var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.Concat(xs, ys, zs);
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await HasNextAsync(e, 7);
+            await HasNextAsync(e, 8);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Concat5Async()
+        {
+            var ex = new Exception("Bang");
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
+            var zs = Throw<int>(ex);
+
+            var res = AsyncEnumerableEx.Concat(xs, ys, zs);
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Concat6Async()
+        {
+            var ex = new Exception("Bang");
+            var res = AsyncEnumerableEx.Concat(ConcatXss(ex));
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Concat9()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = new[] { 4, 5 }.ToAsyncEnumerable();
+            var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.Concat(xs, ys, zs);
+
+            await SequenceIdentity(res);
+        }
+
+        private static IEnumerable<IAsyncEnumerable<int>> ConcatXss(Exception ex)
+        {
+            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            yield return new[] { 4, 5 }.ToAsyncEnumerable();
+            throw ex;
+        }
+    }
+}

+ 41 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Defer.cs

@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Defer : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Defer_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Defer<int>(default(Func<IAsyncEnumerable<int>>)));
+        }
+
+        [Fact]
+        public async Task Defer1Async()
+        {
+            var x = 0;
+            var xs = AsyncEnumerableEx.Defer<int>(() => new[] { x }.ToAsyncEnumerable());
+
+            {
+                var e = xs.GetAsyncEnumerator();
+                await HasNextAsync(e, 0);
+                await NoNextAsync(e);
+            }
+
+            {
+                x++;
+                var e = xs.GetAsyncEnumerator();
+                await HasNextAsync(e, 1);
+                await NoNextAsync(e);
+            }
+        }
+    }
+}

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

@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Distinct : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Distinct_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Distinct<int, int>(Return42, default(Func<int, int>)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Distinct(default(IAsyncEnumerable<int>), x => x));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Distinct(Return42, default(Func<int, int>)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Distinct(default(IAsyncEnumerable<int>), x => x, EqualityComparer<int>.Default));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Distinct(Return42, default(Func<int, int>), EqualityComparer<int>.Default));
+        }
+
+        [Fact]
+        public async Task Distinct1Async()
+        {
+            var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Distinct(x => x / 2);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 4);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Distinct6()
+        {
+            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(k => k);
+
+            var res = new[] { 1, 2, 3, 5, 4 };
+            Assert.True(res.SequenceEqual(await xs.ToArrayAsync()));
+        }
+
+        [Fact]
+        public async Task Distinct7()
+        {
+            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(k => k);
+
+            var res = new List<int> { 1, 2, 3, 5, 4 };
+            Assert.True(res.SequenceEqual(await xs.ToListAsync()));
+        }
+
+        [Fact]
+        public async Task Distinct8()
+        {
+            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(k => k);
+
+            Assert.Equal(5, await xs.CountAsync());
+        }
+
+        [Fact]
+        public async Task Distinct9()
+        {
+            var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(k => k);
+
+            await SequenceIdentity(xs);
+        }
+
+        [Fact]
+        public async Task Distinct11Async()
+        {
+            var xs = AsyncEnumerable.Empty<int>().Distinct(k => k);
+
+            var e = xs.GetAsyncEnumerator();
+
+            await NoNextAsync(e);
+        }
+    }
+}

+ 90 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/DistinctUntilChanged.cs

@@ -0,0 +1,90 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class DistinctUntilChanged : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void DistinctUntilChanged_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.DistinctUntilChanged(default(IAsyncEnumerable<int>)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.DistinctUntilChanged(default, EqualityComparer<int>.Default));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.DistinctUntilChanged(default(IAsyncEnumerable<int>), x => x));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.DistinctUntilChanged(Return42, default(Func<int, int>)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.DistinctUntilChanged(default(IAsyncEnumerable<int>), x => x, EqualityComparer<int>.Default));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.DistinctUntilChanged(Return42, default(Func<int, int>), EqualityComparer<int>.Default));
+        }
+
+        [Fact]
+        public async Task DistinctUntilChanged1Async()
+        {
+            var xs = new[] { 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 7, 3, 2, 2, 1, 1 }.ToAsyncEnumerable().DistinctUntilChanged();
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await HasNextAsync(e, 7);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 1);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task DistinctUntilChanged2Async()
+        {
+            var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => (x + 1) / 2);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 2);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task DistinctUntilChanged3Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => { if (x == 4) throw ex; return x; });
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task DistinctUntilChanged4()
+        {
+            var xs = new[] { 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 7, 3, 2, 2, 1, 1 }.ToAsyncEnumerable().DistinctUntilChanged();
+
+            await SequenceIdentity(xs);
+        }
+
+        [Fact]
+        public async Task DistinctUntilChanged5()
+        {
+            var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => (x + 1) / 2);
+
+            await SequenceIdentity(xs);
+        }
+    }
+}

+ 178 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Do.cs

@@ -0,0 +1,178 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Do : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Do_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(default, x => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, default(Action<int>)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(default, x => { }, () => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, default, () => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, x => { }, default(Action)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(default, x => { }, ex => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, default, ex => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, x => { }, default(Action<Exception>)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(default, x => { }, ex => { }, () => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, default, ex => { }, () => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, x => { }, default, () => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, x => { }, ex => { }, default));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(default, new MyObs()));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Do<int>(Return42, default(IObserver<int>)));
+        }
+
+        [Fact]
+        public async Task Do1Async()
+        {
+            var sum = 0;
+            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
+            var ys = xs.Do(x => sum += x);
+
+            var e = ys.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            Assert.Equal(1, sum);
+            await HasNextAsync(e, 2);
+            Assert.Equal(3, sum);
+            await HasNextAsync(e, 3);
+            Assert.Equal(6, sum);
+            await HasNextAsync(e, 4);
+            Assert.Equal(10, sum);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Do2()
+        {
+            var ex = new Exception("Bang");
+            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
+            var ys = xs.Do(x => { throw ex; });
+
+            var e = ys.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Do3Async()
+        {
+            var sum = 0;
+            var fail = false;
+            var done = false;
+            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
+            var ys = xs.Do(x => sum += x, ex => { fail = true; }, () => { done = true; });
+
+            var e = ys.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            Assert.Equal(1, sum);
+            await HasNextAsync(e, 2);
+            Assert.Equal(3, sum);
+            await HasNextAsync(e, 3);
+            Assert.Equal(6, sum);
+            await HasNextAsync(e, 4);
+            Assert.Equal(10, sum);
+            await NoNextAsync(e);
+
+            Assert.False(fail);
+            Assert.True(done);
+        }
+
+        [Fact]
+        public async Task Do4Async()
+        {
+            var sum = 0;
+            var done = false;
+            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
+            var ys = xs.Do(x => sum += x, () => { done = true; });
+
+            var e = ys.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            Assert.Equal(1, sum);
+            await HasNextAsync(e, 2);
+            Assert.Equal(3, sum);
+            await HasNextAsync(e, 3);
+            Assert.Equal(6, sum);
+            await HasNextAsync(e, 4);
+            Assert.Equal(10, sum);
+            await NoNextAsync(e);
+
+            Assert.True(done);
+        }
+
+        [Fact]
+        public async Task Do5()
+        {
+            var ex = new Exception("Bang");
+            var exa = default(Exception);
+            var done = false;
+            var hasv = false;
+            var xs = Throw<int>(ex);
+            var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; }, () => { done = true; });
+
+            var e = ys.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+
+            Assert.False(hasv);
+            Assert.False(done);
+            Assert.Same(exa, ex);
+        }
+
+        [Fact]
+        public async Task Do6()
+        {
+            var ex = new Exception("Bang");
+            var exa = default(Exception);
+            var hasv = false;
+            var xs = Throw<int>(ex);
+            var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; });
+
+            var e = ys.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+
+            Assert.False(hasv);
+            Assert.Same(exa, ex);
+        }
+
+        [Fact]
+        public async Task Do7()
+        {
+            var sum = 0;
+            var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
+            var ys = xs.Do(x => sum += x);
+
+            await SequenceIdentity(ys);
+
+            Assert.Equal(20, sum);
+        }
+
+        private sealed class MyObs : IObserver<int>
+        {
+            public void OnCompleted()
+            {
+                throw new NotImplementedException();
+            }
+
+            public void OnError(Exception error)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void OnNext(int value)
+            {
+                throw new NotImplementedException();
+            }
+        }
+    }
+}

+ 67 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Expand.cs

@@ -0,0 +1,67 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Expand : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Expand_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Expand(default(IAsyncEnumerable<int>), x => default(IAsyncEnumerable<int>)));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Expand(Return42, default(Func<int, IAsyncEnumerable<int>>)));
+        }
+
+        [Fact]
+        public async Task Expand1Async()
+        {
+            var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => AsyncEnumerableEx.Return(x - 1).Repeat(x - 1));
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 1);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Expand2()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(new Func<int, IAsyncEnumerable<int>>(x => { throw ex; }));
+
+            var e = xs.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Expand3Async()
+        {
+            var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => default(IAsyncEnumerable<int>));
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await AssertThrowsAsync<NullReferenceException>(e.MoveNextAsync().AsTask());
+        }
+
+        [Fact]
+        public async Task Expand4()
+        {
+            var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => AsyncEnumerableEx.Return(x - 1).Repeat(x - 1));
+
+            await SequenceIdentity(xs);
+        }
+    }
+}

+ 120 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Finally.cs

@@ -0,0 +1,120 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Finally : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Finally_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Finally(default(IAsyncEnumerable<int>), () => { }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Finally(Return42, default(Action)));
+        }
+
+        [Fact]
+        public async Task Finally1Async()
+        {
+            var b = false;
+
+            var xs = AsyncEnumerable.Empty<int>().Finally(() => { b = true; });
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.False(b);
+            await NoNextAsync(e);
+
+            Assert.True(b);
+        }
+
+        [Fact]
+        public async Task Finally2Async()
+        {
+            var b = false;
+
+            var xs = Return42.Finally(() => { b = true; });
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.False(b);
+            await HasNextAsync(e, 42);
+
+            Assert.False(b);
+            await NoNextAsync(e);
+
+            Assert.True(b);
+        }
+
+        [Fact]
+        public async Task Finally3Async()
+        {
+            var ex = new Exception("Bang!");
+
+            var b = false;
+
+            var xs = Throw<int>(ex).Finally(() => { b = true; });
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.False(b);
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+
+            Assert.True(b);
+        }
+
+        [Fact]
+        public async Task Finally4Async()
+        {
+            var b = false;
+
+            var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; });
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.False(b);
+            await HasNextAsync(e, 1);
+
+            Assert.False(b);
+            await HasNextAsync(e, 2);
+
+            Assert.False(b);
+            await NoNextAsync(e);
+
+            Assert.True(b);
+        }
+
+        [Fact]
+        public async Task Finally5()
+        {
+            var b = false;
+
+            var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; });
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.False(b);
+            await HasNextAsync(e, 1);
+
+            await e.DisposeAsync();
+
+            Assert.True(b);
+        }
+
+        [Fact]
+        public async Task Finally7()
+        {
+            var i = 0;
+            var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { i++; });
+
+            await SequenceIdentity(xs);
+            Assert.Equal(2, i);
+        }
+    }
+}

+ 77 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Generate.cs

@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Generate : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Generate_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Generate<int, int>(0, default, x => x, x => x));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Generate<int, int>(0, x => true, default, x => x));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Generate<int, int>(0, x => true, x => x, default));
+        }
+
+        [Fact]
+        public async Task Generate1()
+        {
+            var xs = AsyncEnumerableEx.Generate(0, x => x < 5, x => x + 1, x => x * x);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 0);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 9);
+            await HasNextAsync(e, 16);
+            await NoNextAsync(e);
+            await e.DisposeAsync();
+        }
+
+        [Fact]
+        public async Task Generate2Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = AsyncEnumerableEx.Generate(0, x => { throw ex; }, x => x + 1, x => x * x);
+
+            var e = xs.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Generate3Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = AsyncEnumerableEx.Generate(0, x => true, x => x + 1, x => { if (x == 1) throw ex; return x * x; });
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 0);
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Generate4Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = AsyncEnumerableEx.Generate(0, x => true, x => { throw ex; }, x => x * x);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 0);
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Generate5()
+        {
+            var xs = AsyncEnumerableEx.Generate(0, x => x < 5, x => x + 1, x => x * x);
+
+            await SequenceIdentity(xs);
+        }
+    }
+}

+ 66 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/IgnoreElements.cs

@@ -0,0 +1,66 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class IgnoreElements : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void IgnoreElements_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.IgnoreElements(default(IAsyncEnumerable<int>)));
+        }
+
+        [Fact]
+        public async Task IgnoreElements1Async()
+        {
+            var xs = AsyncEnumerable.Empty<int>().IgnoreElements();
+
+            var e = xs.GetAsyncEnumerator();
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task IgnoreElements2Async()
+        {
+            var xs = Return42.IgnoreElements();
+
+            var e = xs.GetAsyncEnumerator();
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task IgnoreElements3Async()
+        {
+            var xs = AsyncEnumerable.Range(0, 10).IgnoreElements();
+
+            var e = xs.GetAsyncEnumerator();
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task IgnoreElements4Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = Throw<int>(ex).IgnoreElements();
+
+            var e = xs.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task IgnoreElements5()
+        {
+            var xs = AsyncEnumerable.Range(0, 10).IgnoreElements();
+
+            await SequenceIdentity(xs);
+        }
+    }
+}

+ 22 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/IsEmpty.cs

@@ -0,0 +1,22 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class IsEmpty : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task IsEmpty_Null()
+        {
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.IsEmptyAsync<int>(default).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.IsEmptyAsync<int>(default, CancellationToken.None).AsTask());
+        }
+    }
+}

+ 24 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Max.cs

@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Max : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task Max_Null()
+        {
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxAsync(default, Comparer<DateTime>.Default).AsTask());
+
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxAsync(default, Comparer<DateTime>.Default, CancellationToken.None).AsTask());
+        }
+    }
+}

+ 76 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/MaxBy.cs

@@ -0,0 +1,76 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class MaxBy : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task MaxBy_Null()
+        {
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxByAsync(default(IAsyncEnumerable<int>), x => x).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxByAsync(Return42, default(Func<int, int>)).AsTask());
+
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxByAsync(default(IAsyncEnumerable<int>), x => x, Comparer<int>.Default).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxByAsync(Return42, default(Func<int, int>), Comparer<int>.Default).AsTask());
+
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxByAsync(default(IAsyncEnumerable<int>), x => x, CancellationToken.None).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxByAsync(Return42, default(Func<int, int>), CancellationToken.None).AsTask());
+
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxByAsync(default(IAsyncEnumerable<int>), x => x, Comparer<int>.Default, CancellationToken.None).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MaxByAsync(Return42, default(Func<int, int>), Comparer<int>.Default, CancellationToken.None).AsTask());
+        }
+
+        [Fact]
+        public async Task MaxBy1Async()
+        {
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxByAsync(x => x / 2);
+            var res = await xs;
+
+            Assert.True(res.SequenceEqual(new[] { 7, 6 }));
+        }
+
+        [Fact]
+        public async Task MaxBy2()
+        {
+            var xs = new int[0].ToAsyncEnumerable().MaxByAsync(x => x / 2);
+
+            await AssertThrowsAsync<InvalidOperationException>(xs.AsTask());
+        }
+
+        [Fact]
+        public async Task MaxBy3()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxByAsync(x => { if (x == 3) throw ex; return x; });
+
+            await AssertThrowsAsync(xs, ex);
+        }
+
+        [Fact]
+        public async Task MaxBy4()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxByAsync(x => { if (x == 4) throw ex; return x; });
+
+            await AssertThrowsAsync(xs, ex);
+        }
+
+        [Fact]
+        public async Task MaxBy5()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(Throw<int>(ex)).MaxByAsync(x => x, Comparer<int>.Default);
+
+            await AssertThrowsAsync(xs, ex);
+        }
+    }
+}

+ 24 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Min.cs

@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Min : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task Min_Null()
+        {
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinAsync(default, Comparer<DateTime>.Default).AsTask());
+
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinAsync(default, Comparer<DateTime>.Default, CancellationToken.None).AsTask());
+        }
+    }
+}

+ 76 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/MinBy.cs

@@ -0,0 +1,76 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class MinBy : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task MinBy_Null()
+        {
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinByAsync(default(IAsyncEnumerable<int>), x => x).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinByAsync(Return42, default(Func<int, int>)).AsTask());
+
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinByAsync(default(IAsyncEnumerable<int>), x => x, Comparer<int>.Default).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinByAsync(Return42, default(Func<int, int>), Comparer<int>.Default).AsTask());
+
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinByAsync(default(IAsyncEnumerable<int>), x => x, CancellationToken.None).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinByAsync(Return42, default(Func<int, int>), CancellationToken.None).AsTask());
+
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinByAsync(default(IAsyncEnumerable<int>), x => x, Comparer<int>.Default, CancellationToken.None).AsTask());
+            await Assert.ThrowsAsync<ArgumentNullException>(() => AsyncEnumerableEx.MinByAsync(Return42, default(Func<int, int>), Comparer<int>.Default, CancellationToken.None).AsTask());
+        }
+
+        [Fact]
+        public async Task MinBy1Async()
+        {
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinByAsync(x => x / 2);
+            var res = await xs;
+
+            Assert.True(res.SequenceEqual(new[] { 3, 2 }));
+        }
+
+        [Fact]
+        public async Task MinBy2Async()
+        {
+            var xs = new int[0].ToAsyncEnumerable().MinByAsync(x => x / 2);
+
+            await AssertThrowsAsync<InvalidOperationException>(xs.AsTask());
+        }
+
+        [Fact]
+        public async Task MinBy3Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinByAsync(x => { if (x == 3) throw ex; return x; });
+
+            await AssertThrowsAsync(xs, ex);
+        }
+
+        [Fact]
+        public async Task MinBy4Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinByAsync(x => { if (x == 4) throw ex; return x; });
+
+            await AssertThrowsAsync(xs, ex);
+        }
+
+        [Fact]
+        public async Task MinBy5Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(Throw<int>(ex)).MinByAsync(x => x, Comparer<int>.Default);
+
+            await AssertThrowsAsync(xs, ex);
+        }
+    }
+}

+ 44 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Never.cs

@@ -0,0 +1,44 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Never : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task Never1()
+        {
+            var xs = AsyncEnumerableEx.Never<int>();
+
+            var e = xs.GetAsyncEnumerator();
+            Assert.False(e.MoveNextAsync().IsCompleted); // Very rudimentary check
+            await e.DisposeAsync();
+        }
+
+        [Fact]
+        public async Task CancelToken_UnblocksAsync()
+        {
+            var cts = new CancellationTokenSource();
+
+            var en = AsyncEnumerableEx.Never<int>().GetAsyncEnumerator(cts.Token);
+
+            try
+            {
+                cts.CancelAfter(100);
+
+                await Assert.ThrowsAsync<TaskCanceledException>(() => en.MoveNextAsync().AsTask());
+            }
+            finally
+            {
+                await en.DisposeAsync();
+            }
+        }
+    }
+}

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

@@ -0,0 +1,147 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class OnErrorResumeNext : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void OnErrorResumeNext_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.OnErrorResumeNext<int>(default, Return42));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.OnErrorResumeNext<int>(Return42, default));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.OnErrorResumeNext<int>(default));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.OnErrorResumeNext<int>(default(IEnumerable<IAsyncEnumerable<int>>)));
+        }
+
+        [Fact]
+        public async Task OnErrorResumeNext7Async()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.OnErrorResumeNext(xs, ys);
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task OnErrorResumeNext8Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.OnErrorResumeNext(xs, ys);
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task OnErrorResumeNext9Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.OnErrorResumeNext(new[] { xs, xs, ys, ys });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 5);
+            await HasNextAsync(e, 6);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task OnErrorResumeNext10Async()
+        {
+            var ex = new Exception("Bang!");
+            var res = OnErrorResumeNextXss(ex).OnErrorResumeNext();
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        private IEnumerable<IAsyncEnumerable<int>> OnErrorResumeNextXss(Exception ex)
+        {
+            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(new Exception("!!!")));
+            throw ex;
+        }
+
+        [Fact]
+        public async Task OnErrorResumeNext11Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+
+            var res = AsyncEnumerableEx.OnErrorResumeNext(new[] { xs, xs });
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task OnErrorResumeNext12Async()
+        {
+            var res = AsyncEnumerableEx.OnErrorResumeNext(Enumerable.Empty<IAsyncEnumerable<int>>());
+
+            var e = res.GetAsyncEnumerator();
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task OnErrorResumeNext13()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
+
+            var res = AsyncEnumerableEx.OnErrorResumeNext(xs, ys);
+
+            await SequenceIdentity(res);
+        }
+    }
+}

+ 156 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Repeat.cs

@@ -0,0 +1,156 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Repeat : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task RepeatValue1()
+        {
+            var xs = AsyncEnumerableEx.Repeat(2);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 2);
+            await e.DisposeAsync();
+        }
+
+        [Fact]
+        public async Task RepeatValue2()
+        {
+            var xs = AsyncEnumerableEx.Repeat(2).Take(5);
+
+            await SequenceIdentity(xs);
+        }
+
+        [Fact]
+        public void RepeatSequence_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Repeat(default(IAsyncEnumerable<int>)));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Repeat(default(IAsyncEnumerable<int>), 3));
+            Assert.Throws<ArgumentOutOfRangeException>(() => AsyncEnumerableEx.Repeat(Return42, -1));
+        }
+
+        [Fact]
+        public async Task RepeatSequence1Async()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat();
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+        }
+
+        [Fact]
+        public async Task RepeatSequence2Async()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat(3);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task RepeatSequence3Async()
+        {
+            var i = 0;
+            var xs = RepeatXs(() => i++).ToAsyncEnumerable().Repeat(3);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await NoNextAsync(e);
+
+            Assert.Equal(3, i);
+        }
+
+        [Fact]
+        public async Task RepeatSequence4Async()
+        {
+            var i = 0;
+            var xs = RepeatXs(() => i++).ToAsyncEnumerable().Repeat(0);
+
+            var e = xs.GetAsyncEnumerator();
+
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task RepeatSequence5()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat(3);
+
+            await SequenceIdentity(xs);
+        }
+
+        [Fact]
+        public async Task RepeatSequence6Async()
+        {
+            var xs = new FailRepeat().ToAsyncEnumerable().Repeat();
+
+            var e = xs.GetAsyncEnumerator();
+            await AssertThrowsAsync<NotImplementedException>(e.MoveNextAsync().AsTask());
+        }
+
+        [Fact]
+        public async Task RepeatSequence7Async()
+        {
+            var xs = new FailRepeat().ToAsyncEnumerable().Repeat(3);
+
+            var e = xs.GetAsyncEnumerator();
+            await AssertThrowsAsync<NotImplementedException>(e.MoveNextAsync().AsTask());
+        }
+
+        private static IEnumerable<int> RepeatXs(Action started)
+        {
+            started();
+
+            yield return 1;
+            yield return 2;
+        }
+
+        private sealed class FailRepeat : IEnumerable<int>
+        {
+            public IEnumerator<int> GetEnumerator()
+            {
+                throw new NotImplementedException();
+            }
+
+            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+            {
+                throw new NotImplementedException();
+            }
+        }
+    }
+}

+ 59 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Retry.cs

@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Retry : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Retry_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Retry<int>(default));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Retry<int>(default, 1));
+            Assert.Throws<ArgumentOutOfRangeException>(() => AsyncEnumerableEx.Retry<int>(Return42, -1));
+        }
+
+        [Fact]
+        public async Task Retry1Async()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+
+            var res = xs.Retry();
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Retry2Async()
+        {
+            var ex = new InvalidOperationException("Bang!");
+
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
+
+            var res = xs.Retry();
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await HasNextAsync(e, 3);
+        }
+    }
+}

+ 20 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Return.cs

@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Return : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task Return1Async()
+        {
+            var xs = AsyncEnumerableEx.Return(42);
+            await HasNextAsync(xs.GetAsyncEnumerator(), 42);
+        }
+    }
+}

+ 84 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Scan.cs

@@ -0,0 +1,84 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Scan : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Scan_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Scan(default(IAsyncEnumerable<int>), 3, (x, y) => x + y));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Scan(Return42, 3, default(Func<int, int, int>)));
+
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Scan(default(IAsyncEnumerable<int>), (x, y) => x + y));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Scan(Return42, default(Func<int, int, int>)));
+        }
+
+        [Fact]
+        public async Task Scan1Async()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => x + y);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 9);
+            await HasNextAsync(e, 11);
+            await HasNextAsync(e, 14);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Scan2Async()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => x + y);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 6);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task Scan3()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, new Func<int, int, int>((x, y) => { throw ex; }));
+
+            var e = xs.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Scan4()
+        {
+            var ex = new Exception("Bang!");
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(new Func<int, int, int>((x, y) => { throw ex; }));
+
+            var e = xs.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+
+        [Fact]
+        public async Task Scan5()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => x + y);
+
+            await SequenceIdentity(xs);
+        }
+
+        [Fact]
+        public async Task Scan6()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => x + y);
+
+            await SequenceIdentity(xs);
+        }
+    }
+}

+ 39 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/SelectMany.cs

@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class SelectMany : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void SelectMany_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.SelectMany<int, int>(default, Return42));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.SelectMany<int, int>(Return42, default));
+        }
+
+        [Fact]
+        public async Task SelectMany1Async()
+        {
+            var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
+            var ys = new[] { 3, 4 }.ToAsyncEnumerable();
+
+            var res = xs.SelectMany(ys);
+
+            var e = res.GetAsyncEnumerator();
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await HasNextAsync(e, 3);
+            await HasNextAsync(e, 4);
+            await NoNextAsync(e);
+        }
+    }
+}

+ 56 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/StartWith.cs

@@ -0,0 +1,56 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class StartWith : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void StartWith_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.StartWith(default, new[] { 1 }));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.StartWith(Return42, default));
+        }
+
+        [Fact]
+        public async Task StartWith1Async()
+        {
+            var xs = AsyncEnumerable.Empty<int>().StartWith(1, 2);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task StartWith2Async()
+        {
+            var xs = Return42.StartWith(40, 41);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 40);
+            await HasNextAsync(e, 41);
+            await HasNextAsync(e, 42);
+            await NoNextAsync(e);
+        }
+
+        [Fact]
+        public async Task StartWith3Async()
+        {
+            var ex = new Exception("Bang!");
+            var xs = Throw<int>(ex).StartWith(1, 2);
+
+            var e = xs.GetAsyncEnumerator();
+            await HasNextAsync(e, 1);
+            await HasNextAsync(e, 2);
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+        }
+    }
+}

+ 24 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Throw.cs

@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Throw : AsyncEnumerableExTests
+    {
+        [Fact]
+        public async Task Throw1()
+        {
+            var ex = new Exception("Bang!");
+            var xs = AsyncEnumerableEx.Throw<int>(ex);
+            var e = xs.GetAsyncEnumerator();
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+            Assert.False(await e.MoveNextAsync());
+        }
+    }
+}

+ 196 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Using.cs

@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Tests
+{
+    public class Using : AsyncEnumerableExTests
+    {
+        [Fact]
+        public void Using_Null()
+        {
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Using<int, IDisposable>(default, _ => default(IAsyncEnumerable<int>)));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerableEx.Using<int, IDisposable>(() => new MyD(null), default));
+        }
+
+        [Fact]
+        public void Using1()
+        {
+            var i = 0;
+            var d = 0;
+
+            var xs = AsyncEnumerableEx.Using(
+                () =>
+                {
+                    i++;
+                    return new MyD(() => { d++; });
+                },
+                _ => Return42
+            );
+
+            Assert.Equal(0, i);
+            Assert.Equal(0, d);
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.Equal(0, i);
+            Assert.Equal(0, d);
+        }
+
+        [Fact]
+        public async Task Using2()
+        {
+            var i = 0;
+            var d = 0;
+
+            var xs = AsyncEnumerableEx.Using(
+                () =>
+                {
+                    i++;
+                    return new MyD(() => { d++; });
+                },
+                _ => Return42
+            );
+
+            Assert.Equal(0, i);
+            Assert.Equal(0, d);
+
+            var e = xs.GetAsyncEnumerator();
+            Assert.Equal(0, i);
+            Assert.Equal(0, d);
+
+            await e.DisposeAsync();
+
+            Assert.Equal(0, i);
+            Assert.Equal(0, d);
+        }
+
+        [Fact]
+        public async Task Using3()
+        {
+            var ex = new Exception("Bang!");
+            var i = 0;
+            var d = 0;
+
+            var xs = AsyncEnumerableEx.Using<int, MyD>(
+                () =>
+                {
+                    i++;
+                    return new MyD(() => { d++; });
+                },
+                _ => { throw ex; }
+            );
+
+            Assert.Equal(0, i);
+            Assert.Equal(0, d);
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.Equal(0, i);
+            Assert.Equal(0, d);
+
+            await e.DisposeAsync();
+
+            Assert.Equal(0, i);
+            Assert.Equal(0, d);
+        }
+
+        [Fact]
+        public async Task Using4Async()
+        {
+            var i = 0;
+            var disposed = new TaskCompletionSource<bool>();
+
+            var xs = AsyncEnumerableEx.Using(
+                () =>
+                {
+                    i++;
+                    return new MyD(() => { disposed.TrySetResult(true); });
+                },
+                _ => Return42
+            );
+
+            Assert.Equal(0, i);
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.Equal(0, i);
+
+            await HasNextAsync(e, 42);
+
+            Assert.Equal(1, i);
+
+            await NoNextAsync(e);
+
+            Assert.True(await disposed.Task);
+        }
+
+        [Fact]
+        public async Task Using5Async()
+        {
+            var ex = new Exception("Bang!");
+            var i = 0;
+            var disposed = new TaskCompletionSource<bool>();
+
+            var xs = AsyncEnumerableEx.Using(
+                () =>
+                {
+                    i++;
+                    return new MyD(() => { disposed.TrySetResult(true); });
+                },
+                _ => Throw<int>(ex)
+            );
+
+            Assert.Equal(0, i);
+
+            var e = xs.GetAsyncEnumerator();
+
+            Assert.Equal(0, i);
+
+            await AssertThrowsAsync(e.MoveNextAsync(), ex);
+
+            Assert.Equal(1, i);
+
+            Assert.True(await disposed.Task);
+        }
+
+        [Fact]
+        public async Task Using7()
+        {
+            var i = 0;
+            var d = 0;
+
+            var xs = AsyncEnumerableEx.Using(
+                () =>
+                {
+                    i++;
+                    return new MyD(() => { d++; });
+                },
+                _ => Return42
+            );
+
+            await SequenceIdentity(xs);
+        }
+
+        private sealed class MyD : IDisposable
+        {
+            private readonly Action _dispose;
+
+            public MyD(Action dispose)
+            {
+                _dispose = dispose;
+            }
+
+            public void Dispose()
+            {
+                _dispose();
+            }
+        }
+    }
+}

+ 5 - 5
Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs

@@ -1,11 +1,12 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // 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 Xunit;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
-using Xunit;
 
 namespace Tests
 {
@@ -17,7 +18,7 @@ namespace Tests
             try
             {
                 var asyncEnumerable = AsyncEnumerable.ToAsyncEnumerable(GetEnumerableWithError());
-                await asyncEnumerable.ToArray();
+                await asyncEnumerable.ToArrayAsync();
             }
             catch (AggregateException)
             {
@@ -39,8 +40,8 @@ namespace Tests
         {
             try
             {
-                var asyncEnumerable = AsyncEnumerable.Generate(15, (x) => { throw new InvalidOperationException(); }, (x) => { return 20; }, (x) => { return 2; });
-                await asyncEnumerable.ToArray();
+                var asyncEnumerable = AsyncEnumerableEx.Generate(15, (x) => { throw new InvalidOperationException(); }, (x) => { return 20; }, (x) => { return 2; });
+                await asyncEnumerable.ToArrayAsync();
             }
             catch (AggregateException)
             {
@@ -52,4 +53,3 @@ namespace Tests
         }
     }
 }
-

+ 0 - 152
Ix.NET/Source/System.Interactive.Async/Aggregate.cs

@@ -1,152 +0,0 @@
-// // Licensed to the .NET Foundation under one or more agreements.
-// // 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (accumulator == null)
-            {
-                throw new ArgumentNullException(nameof(accumulator));
-            }
-
-            if (resultSelector == null)
-            {
-                throw new ArgumentNullException(nameof(resultSelector));
-            }
-
-            return Aggregate(source, seed, accumulator, resultSelector, CancellationToken.None);
-        }
-
-        public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (accumulator == null)
-            {
-                throw new ArgumentNullException(nameof(accumulator));
-            }
-
-            return Aggregate(source, seed, accumulator, CancellationToken.None);
-        }
-
-        public static Task<TSource> Aggregate<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (accumulator == null)
-            {
-                throw new ArgumentNullException(nameof(accumulator));
-            }
-
-            return Aggregate(source, accumulator, CancellationToken.None);
-        }
-
-        public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (accumulator == null)
-            {
-                throw new ArgumentNullException(nameof(accumulator));
-            }
-
-            if (resultSelector == null)
-            {
-                throw new ArgumentNullException(nameof(resultSelector));
-            }
-
-            return Aggregate_(source, seed, accumulator, resultSelector, cancellationToken);
-        }
-
-        public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (accumulator == null)
-            {
-                throw new ArgumentNullException(nameof(accumulator));
-            }
-
-            return source.Aggregate(seed, accumulator, x => x, cancellationToken);
-        }
-
-        public static Task<TSource> Aggregate<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (accumulator == null)
-            {
-                throw new ArgumentNullException(nameof(accumulator));
-            }
-
-            return Aggregate_(source, accumulator, cancellationToken);
-        }
-
-        private static async Task<TResult> Aggregate_<TSource, TAccumulate, TResult>(IAsyncEnumerable<TSource> source, TAccumulate seed,
-                                                                                     Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector, CancellationToken cancellationToken)
-        {
-            var acc = seed;
-
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    acc = accumulator(acc, e.Current);
-                }
-            }
-
-            return resultSelector(acc);
-        }
-
-        private static async Task<TSource> Aggregate_<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator, CancellationToken cancellationToken)
-        {
-            var first = true;
-            var acc = default(TSource);
-
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    acc = first ? e.Current : accumulator(acc, e.Current);
-                    first = false;
-                }
-            }
-            if (first)
-            {
-                throw new InvalidOperationException(Strings.NO_ELEMENTS);
-            }
-
-            return acc;
-        }
-    }
-}

+ 0 - 128
Ix.NET/Source/System.Interactive.Async/AnyAll.cs

@@ -1,128 +0,0 @@
-// // Licensed to the .NET Foundation under one or more agreements.
-// // 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static Task<bool> All<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return All(source, predicate, CancellationToken.None);
-        }
-
-        public static Task<bool> All<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return All_(source, predicate, cancellationToken);
-        }
-
-        public static Task<bool> Any<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return Any(source, predicate, CancellationToken.None);
-        }
-
-        public static Task<bool> Any<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Any(source, CancellationToken.None);
-        }
-
-        public static Task<bool> Any<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return Any_(source, predicate, cancellationToken);
-        }
-
-        public static async Task<bool> Any<TSource>(this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            using (var e = source.GetEnumerator())
-            {
-                return await e.MoveNext(cancellationToken).ConfigureAwait(false);
-            }
-        }
-
-        private static async Task<bool> All_<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    if (!predicate(e.Current))
-                    {
-                        return false;
-                    }
-                }
-            }
-            return true;
-        }
-
-        private static async Task<bool> Any_<TSource>(IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    if (predicate(e.Current))
-                    {
-                        return true;
-                    }
-                }
-            }
-            return false;
-        }
-    }
-}

+ 0 - 505
Ix.NET/Source/System.Interactive.Async/AppendPrepend.cs

@@ -1,505 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> Append<TSource>(this IAsyncEnumerable<TSource> source, TSource element)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (source is AppendPrepentAsyncIterator<TSource> appendable)
-            {
-                return appendable.Append(element);
-            }
-
-            return new AppendPrepend1AsyncIterator<TSource>(source, element, true);
-        }
-
-        public static IAsyncEnumerable<TSource> Prepend<TSource>(this IAsyncEnumerable<TSource> source, TSource element)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (source is AppendPrepentAsyncIterator<TSource> appendable)
-            {
-                return appendable.Prepend(element);
-            }
-
-            return new AppendPrepend1AsyncIterator<TSource>(source, element, false);
-        }
-
-        private abstract class AppendPrepentAsyncIterator<TSource> : AsyncIterator<TSource>, IIListProvider<TSource>
-        {
-            protected readonly IAsyncEnumerable<TSource> source;
-            protected IAsyncEnumerator<TSource> enumerator;
-
-            protected AppendPrepentAsyncIterator(IAsyncEnumerable<TSource> source)
-            {
-                Debug.Assert(source != null);
-
-                this.source = source;
-            }
-
-            protected void GetSourceEnumerator()
-            {
-                Debug.Assert(enumerator == null);
-                enumerator = source.GetEnumerator();
-            }
-
-            public abstract AppendPrepentAsyncIterator<TSource> Append(TSource item);
-            public abstract AppendPrepentAsyncIterator<TSource> Prepend(TSource item);
-
-            protected async Task<bool> LoadFromEnumerator(CancellationToken cancellationToken)
-            {
-                if (await enumerator.MoveNext(cancellationToken)
-                                    .ConfigureAwait(false))
-                {
-                    current = enumerator.Current;
-                    return true;
-                }
-
-                enumerator?.Dispose();
-                enumerator = null;
-
-                return false;
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                }
-
-                base.Dispose();
-            }
-
-            public abstract Task<TSource[]> ToArrayAsync(CancellationToken cancellationToken);
-            public abstract Task<List<TSource>> ToListAsync(CancellationToken cancellationToken);
-            public abstract Task<int> GetCountAsync(bool onlyIfCheap, CancellationToken cancellationToken);
-        }
-
-        private sealed class AppendPrepend1AsyncIterator<TSource> : AppendPrepentAsyncIterator<TSource>
-        {
-            private readonly TSource item;
-            private readonly bool appending;
-            private bool hasEnumerator;
-
-            public AppendPrepend1AsyncIterator(IAsyncEnumerable<TSource> source, TSource item, bool appending)
-                : base(source)
-            {
-                this.item = item;
-                this.appending = appending;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new AppendPrepend1AsyncIterator<TSource>(source, item, appending);
-            }
-
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        hasEnumerator = false;
-                        state = AsyncIteratorState.Iterating;
-                        if (!appending)
-                        {
-                            current = item;
-                            return true;
-                        }
-
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        if (!hasEnumerator)
-                        {
-                            GetSourceEnumerator();
-                            hasEnumerator = true;
-                        }
-
-                        if (enumerator != null)
-                        {
-                            if (await LoadFromEnumerator(cancellationToken)
-                                .ConfigureAwait(false))
-                            {
-                                return true;
-                            }
-
-                            if (appending)
-                            {
-                                current = item;
-                                return true;
-                            }
-                        }
-
-                        break;
-                }
-
-                Dispose();
-                return false;
-            }
-
-            public override AppendPrepentAsyncIterator<TSource> Append(TSource element)
-            {
-                if (appending)
-                {
-                    return new AppendPrependNAsyncIterator<TSource>(source, null, new SingleLinkedNode<TSource>(item, element));
-                }
-
-                return new AppendPrependNAsyncIterator<TSource>(source, new SingleLinkedNode<TSource>(item), new SingleLinkedNode<TSource>(element));
-            }
-
-            public override AppendPrepentAsyncIterator<TSource> Prepend(TSource element)
-            {
-                if (appending)
-                {
-                    return new AppendPrependNAsyncIterator<TSource>(source, new SingleLinkedNode<TSource>(element), new SingleLinkedNode<TSource>(item));
-                }
-
-                return new AppendPrependNAsyncIterator<TSource>(source, new SingleLinkedNode<TSource>(item, element), null);
-            }
-
-            public override async Task<TSource[]> ToArrayAsync(CancellationToken cancellationToken)
-            {
-                var count = await GetCountAsync(onlyIfCheap: true, cancellationToken: cancellationToken).ConfigureAwait(false);
-                if (count == -1)
-                {
-                    return await AsyncEnumerableHelpers.ToArray(this, cancellationToken).ConfigureAwait(false);
-                }
-
-                var array = new TSource[count];
-                int index;
-                if (appending)
-                {
-                    index = 0;
-                }
-                else
-                {
-                    array[0] = item;
-                    index = 1;
-                }
-
-                if (source is ICollection<TSource> sourceCollection)
-                {
-                    sourceCollection.CopyTo(array, index);
-                }
-                else
-                {
-                    using (var en = source.GetEnumerator())
-                    {
-                        while (await en.MoveNext(cancellationToken)
-                                       .ConfigureAwait(false))
-                        {
-                            array[index] = en.Current;
-                            ++index;
-                        }
-                    }
-                }
-
-                if (appending)
-                {
-                    array[array.Length - 1] = item;
-                }
-
-                return array;
-            }
-
-            public override async Task<List<TSource>> ToListAsync(CancellationToken cancellationToken)
-            {
-                var count = await GetCountAsync(onlyIfCheap: true, cancellationToken: cancellationToken).ConfigureAwait(false);
-                var list = count == -1 ? new List<TSource>() : new List<TSource>(count);
-
-                if (!appending)
-                {
-                    list.Add(item);
-                }
-
-
-                using (var en = source.GetEnumerator())
-                {
-                    while (await en.MoveNext(cancellationToken)
-                                   .ConfigureAwait(false))
-                    {
-                        list.Add(en.Current);
-                    }
-                }
-
-                if (appending)
-                {
-                    list.Add(item);
-                }
-
-                return list;
-            }
-
-            public override async Task<int> GetCountAsync(bool onlyIfCheap, CancellationToken cancellationToken)
-            {
-                if (source is IIListProvider<TSource> listProv)
-                {
-                    var count = await listProv.GetCountAsync(onlyIfCheap, cancellationToken).ConfigureAwait(false);
-                    return count == -1 ? -1 : count + 1;
-                }
-
-                return !onlyIfCheap || source is ICollection<TSource> ? await source.Count(cancellationToken).ConfigureAwait(false) + 1 : -1;
-            }
-        }
-
-        private sealed class SingleLinkedNode<TSource>
-        {
-            public SingleLinkedNode(TSource first, TSource second)
-            {
-                Linked = new SingleLinkedNode<TSource>(first);
-                Item = second;
-                Count = 2;
-            }
-
-            public SingleLinkedNode(TSource item)
-            {
-                Item = item;
-                Count = 1;
-            }
-
-            private SingleLinkedNode(SingleLinkedNode<TSource> linked, TSource item)
-            {
-                Debug.Assert(linked != null);
-                Linked = linked;
-                Item = item;
-                Count = linked.Count + 1;
-            }
-
-            public TSource Item { get; }
-
-            public SingleLinkedNode<TSource> Linked { get; }
-
-            public int Count { get; }
-
-            public SingleLinkedNode<TSource> Add(TSource item) => new SingleLinkedNode<TSource>(this, item);
-
-            public IEnumerator<TSource> GetEnumerator()
-            {
-                var array = new TSource[Count];
-                var index = Count;
-                for (var n = this; n != null; n = n.Linked)
-                {
-                    --index;
-                    array[index] = n.Item;
-                }
-
-                Debug.Assert(index == 0);
-                return ((IEnumerable<TSource>)array).GetEnumerator();
-            }
-        }
-
-        private sealed class AppendPrependNAsyncIterator<TSource> : AppendPrepentAsyncIterator<TSource>
-        {
-            private readonly SingleLinkedNode<TSource> prepended;
-            private readonly SingleLinkedNode<TSource> appended;
-
-            private SingleLinkedNode<TSource> node;
-
-            public AppendPrependNAsyncIterator(IAsyncEnumerable<TSource> source, SingleLinkedNode<TSource> prepended, SingleLinkedNode<TSource> appended)
-                : base(source)
-            {
-                Debug.Assert(prepended != null || appended != null);
-
-                this.prepended = prepended;
-                this.appended = appended;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new AppendPrependNAsyncIterator<TSource>(source, prepended, appended);
-            }
-
-            private int mode;
-            private IEnumerator<TSource> appendedEnumerator;
-
-            public override void Dispose()
-            {
-                if (appendedEnumerator != null)
-                {
-                    appendedEnumerator.Dispose();
-                    appendedEnumerator = null;
-                }
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        mode = 1;
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        switch (mode)
-                        {
-                            case 1:
-                                node = prepended;
-                                mode = 2;
-                                goto case 2;
-
-                            case 2:
-                                if (node != null)
-                                {
-                                    current = node.Item;
-                                    node = node.Linked;
-                                    return true;
-                                }
-
-                                GetSourceEnumerator();
-                                mode = 3;
-                                goto case 3;
-
-                            case 3:
-                                if (await LoadFromEnumerator(cancellationToken)
-                                        .ConfigureAwait(false))
-                                {
-                                    return true;
-                                }
-
-                                if (appended != null)
-                                {
-                                    appendedEnumerator = appended.GetEnumerator();
-                                    mode = 4;
-                                    goto case 4;
-                                }
-
-                                break;
-
-
-                            case 4:
-                                if (appendedEnumerator.MoveNext())
-                                {
-                                    current = appendedEnumerator.Current;
-                                    return true;
-                                }
-                                break;
-                        }
-
-                        break;
-                }
-
-                Dispose();
-                return false;
-            }
-
-            public override AppendPrepentAsyncIterator<TSource> Append(TSource item)
-            {
-                return new AppendPrependNAsyncIterator<TSource>(source, prepended, appended != null ? appended.Add(item) : new SingleLinkedNode<TSource>(item));
-            }
-
-            public override AppendPrepentAsyncIterator<TSource> Prepend(TSource item)
-            {
-                return new AppendPrependNAsyncIterator<TSource>(source, prepended != null ? prepended.Add(item) : new SingleLinkedNode<TSource>(item), appended);
-            }
-
-            public override async Task<TSource[]> ToArrayAsync(CancellationToken cancellationToken)
-            {
-                var count = await GetCountAsync(onlyIfCheap: true, cancellationToken: cancellationToken).ConfigureAwait(false);
-                if (count == -1)
-                {
-                    return await AsyncEnumerableHelpers.ToArray(this, cancellationToken).ConfigureAwait(false);
-                }
-
-                var array = new TSource[count];
-                var index = 0;
-                for (var n = prepended; n != null; n = n.Linked)
-                {
-                    array[index] = n.Item;
-                    ++index;
-                }
-
-                if (source is ICollection<TSource> sourceCollection)
-                {
-                    sourceCollection.CopyTo(array, index);
-                }
-                else
-                {
-                    using (var en = source.GetEnumerator())
-                    {
-                        while (await en.MoveNext(cancellationToken)
-                                       .ConfigureAwait(false))
-                        {
-                            array[index] = en.Current;
-                            ++index;
-                        }
-                    }
-                }
-
-                index = array.Length;
-                for (var n = appended; n != null; n = n.Linked)
-                {
-                    --index;
-                    array[index] = n.Item;
-                }
-
-                return array;
-            }
-
-            public override async Task<List<TSource>> ToListAsync(CancellationToken cancellationToken)
-            {
-                var count = await GetCountAsync(onlyIfCheap: true, cancellationToken: cancellationToken).ConfigureAwait(false);
-                var list = count == -1 ? new List<TSource>() : new List<TSource>(count);
-                for (var n = prepended; n != null; n = n.Linked)
-                {
-                    list.Add(n.Item);
-                }
-
-                using (var en = source.GetEnumerator())
-                {
-                    while (await en.MoveNext(cancellationToken)
-                                   .ConfigureAwait(false))
-                    {
-                        list.Add(en.Current);
-                    }
-                }
-
-                if (appended != null)
-                {
-
-                    using (var en = appended.GetEnumerator())
-                    {
-                        while (en.MoveNext())
-                        {
-                            list.Add(en.Current);
-                        }
-                    }
-                }
-
-                return list;
-            }
-
-            public override async Task<int> GetCountAsync(bool onlyIfCheap, CancellationToken cancellationToken)
-            {
-                if (source is IIListProvider<TSource> listProv)
-                {
-                    var count = await listProv.GetCountAsync(onlyIfCheap, cancellationToken).ConfigureAwait(false);
-                    return count == -1 ? -1 : count + (appended == null ? 0 : appended.Count) + (prepended == null ? 0 : prepended.Count);
-                }
-
-                return !onlyIfCheap || source is ICollection<TSource> ? await source.Count(cancellationToken).ConfigureAwait(false) + (appended == null ? 0 : appended.Count) + (prepended == null ? 0 : prepended.Count) : -1;
-            }
-        }
-    }
-}

+ 0 - 93
Ix.NET/Source/System.Interactive.Async/AsyncEnumerable.cs

@@ -1,93 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> AsAsyncEnumerable<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return source.Select(x => x);
-        }
-
-        public static IAsyncEnumerable<TValue> Empty<TValue>()
-        {
-            return CreateEnumerable(
-                () => CreateEnumerator<TValue>(
-                    ct => TaskExt.False, null, null)
-            );
-        }
-
-        public static Task<bool> IsEmpty<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return source.IsEmpty(CancellationToken.None);
-        }
-
-        public static Task<bool> IsEmpty<TSource>(this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return IsEmpty_(source, cancellationToken);
-        }
-
-        public static IAsyncEnumerable<TValue> Never<TValue>()
-        {
-            return CreateEnumerable(
-                () => CreateEnumerator<TValue>(
-                    (ct, tcs) => tcs.Task,
-                    null,
-                    null)
-            );
-        }
-
-
-        public static IAsyncEnumerable<TValue> Return<TValue>(TValue value)
-        {
-            return new[] { value }.ToAsyncEnumerable();
-        }
-
-        public static IAsyncEnumerable<TValue> Throw<TValue>(Exception exception)
-        {
-            if (exception == null)
-            {
-                throw new ArgumentNullException(nameof(exception));
-            }
-
-            return CreateEnumerable(
-                () => CreateEnumerator<TValue>(
-                    ct =>
-                    {
-                        var tcs = new TaskCompletionSource<bool>();
-                        tcs.TrySetException(exception);
-                        return tcs.Task;
-                    },
-                    null,
-                    null)
-            );
-        }
-
-        private static async Task<bool> IsEmpty_<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            return !await source.Any(cancellationToken)
-                                .ConfigureAwait(false);
-        }
-    }
-}

+ 0 - 28
Ix.NET/Source/System.Interactive.Async/AsyncEnumerator.cs

@@ -1,28 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Threading;
-using System.Threading.Tasks;
-
-namespace System.Collections.Generic
-{
-    public static class AsyncEnumerator
-    {
-        /// <summary>
-        /// Advances the enumerator to the next element in the sequence, returning the result asynchronously.
-        /// </summary>
-        /// <returns>
-        /// Task containing the result of the operation: true if the enumerator was successfully advanced 
-        /// to the next element; false if the enumerator has passed the end of the sequence.
-        /// </returns>
-        public static Task<bool> MoveNext<T>(this IAsyncEnumerator<T> enumerator)
-        {
-            if (enumerator == null)
-            {
-                throw new ArgumentNullException(nameof(enumerator));
-            }
-
-            return enumerator.MoveNext(CancellationToken.None);
-        }
-    }
-}

+ 0 - 141
Ix.NET/Source/System.Interactive.Async/AsyncIterator.cs

@@ -1,141 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        internal abstract class AsyncIterator<TSource> : IAsyncEnumerable<TSource>, IAsyncEnumerator<TSource>
-        {
-            private readonly int threadId;
-
-            private CancellationTokenSource cancellationTokenSource;
-            private bool currentIsInvalid = true;
-
-            internal TSource current;
-            internal AsyncIteratorState state = AsyncIteratorState.New;
-
-            protected AsyncIterator()
-            {
-                threadId = Environment.CurrentManagedThreadId;
-            }
-
-            public IAsyncEnumerator<TSource> GetEnumerator()
-            {
-                var enumerator = state == AsyncIteratorState.New && threadId == Environment.CurrentManagedThreadId ?
-                    this :
-                    Clone();
-
-                enumerator.state = AsyncIteratorState.Allocated;
-                enumerator.cancellationTokenSource = new CancellationTokenSource();
-
-                try
-                {
-                    enumerator.OnGetEnumerator();
-                }
-                catch
-                {
-                    enumerator.Dispose();
-                    throw;
-                }
-
-                return enumerator;
-            }
-
-
-            public virtual void Dispose()
-            {
-                if (cancellationTokenSource != null)
-                {
-                    if (!cancellationTokenSource.IsCancellationRequested)
-                    {
-                        cancellationTokenSource.Cancel();
-                    }
-                    cancellationTokenSource.Dispose();
-                }
-
-                current = default;
-                state = AsyncIteratorState.Disposed;
-            }
-
-            public TSource Current
-            {
-                get
-                {
-                    if (currentIsInvalid)
-                    {
-                        throw new InvalidOperationException("Enumerator is in an invalid state");
-                    }
-
-                    return current;
-                }
-            }
-
-            public async Task<bool> MoveNext(CancellationToken cancellationToken)
-            {
-                // Note: MoveNext *must* be implemented as an async method to ensure
-                // that any exceptions thrown from the MoveNextCore call are handled 
-                // by the try/catch, whether they're sync or async
-
-                if (state == AsyncIteratorState.Disposed)
-                {
-                    return false;
-                }
-
-                using (cancellationToken.Register(Dispose))
-                using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, cancellationTokenSource.Token))
-                {
-                    try
-                    {
-                        // Short circuit and don't even call MoveNexCore
-                        cancellationToken.ThrowIfCancellationRequested();
-
-                        var result = await MoveNextCore(cts.Token)
-                                         .ConfigureAwait(false);
-
-                        currentIsInvalid = !result; // if move next is false, invalid otherwise valid
-
-                        return result;
-                    }
-                    catch
-                    {
-                        currentIsInvalid = true;
-                        Dispose();
-                        throw;
-                    }
-                }
-            }
-
-            public abstract AsyncIterator<TSource> Clone();
-
-            public virtual IAsyncEnumerable<TResult> Select<TResult>(Func<TSource, TResult> selector)
-            {
-                return new SelectEnumerableAsyncIterator<TSource, TResult>(this, selector);
-            }
-
-            public virtual IAsyncEnumerable<TSource> Where(Func<TSource, bool> predicate)
-            {
-                return new WhereEnumerableAsyncIterator<TSource>(this, predicate);
-            }
-
-            protected abstract Task<bool> MoveNextCore(CancellationToken cancellationToken);
-
-            protected virtual void OnGetEnumerator()
-            {
-            }
-        }
-
-        internal enum AsyncIteratorState
-        {
-            New = 0,
-            Allocated = 1,
-            Iterating = 2,
-            Disposed = -1
-        }
-    }
-}

+ 0 - 815
Ix.NET/Source/System.Interactive.Async/Average.cs

@@ -1,815 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static Task<double> Average(this IAsyncEnumerable<int> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<double?> Average(this IAsyncEnumerable<int?> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<double> Average(this IAsyncEnumerable<long> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<double?> Average(this IAsyncEnumerable<long?> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<double> Average(this IAsyncEnumerable<double> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<double?> Average(this IAsyncEnumerable<double?> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<float> Average(this IAsyncEnumerable<float> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<float?> Average(this IAsyncEnumerable<float?> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<decimal> Average(this IAsyncEnumerable<decimal> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<decimal?> Average(this IAsyncEnumerable<decimal?> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average(source, CancellationToken.None);
-        }
-
-        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int?> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, long> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, long?> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, double> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, double?> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<float> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, float> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<float?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, float?> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<decimal> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, decimal> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-        public static Task<decimal?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, decimal?> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return Average(source, selector, CancellationToken.None);
-        }
-
-
-        public static Task<double> Average(this IAsyncEnumerable<int> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<double?> Average(this IAsyncEnumerable<int?> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<double> Average(this IAsyncEnumerable<long> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<double?> Average(this IAsyncEnumerable<long?> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<double> Average(this IAsyncEnumerable<double> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<double?> Average(this IAsyncEnumerable<double?> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<float> Average(this IAsyncEnumerable<float> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<float?> Average(this IAsyncEnumerable<float?> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<decimal> Average(this IAsyncEnumerable<decimal> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<decimal?> Average(this IAsyncEnumerable<decimal?> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Average_(source, cancellationToken);
-        }
-
-        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int?> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, int> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, long> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, long?> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, double> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, double?> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<float> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, float> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<float?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, float?> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<decimal> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, decimal> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        public static Task<decimal?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, decimal?> selector, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return source.Select(selector)
-                         .Average(cancellationToken);
-        }
-
-        private static async Task<double> Average_(this IAsyncEnumerable<int> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                if (!await e.MoveNext(cancellationToken)
-                            .ConfigureAwait(false))
-                {
-                    throw new InvalidOperationException(Strings.NO_ELEMENTS);
-                }
-
-                long sum = e.Current;
-                long count = 1;
-                checked
-                {
-                    while (await e.MoveNext(cancellationToken)
-                                  .ConfigureAwait(false))
-                    {
-                        sum += e.Current;
-                        ++count;
-                    }
-                }
-
-                return (double)sum / count;
-            }
-        }
-
-        private static async Task<double?> Average_(IAsyncEnumerable<int?> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    var v = e.Current;
-                    if (v.HasValue)
-                    {
-                        long sum = v.GetValueOrDefault();
-                        long count = 1;
-                        checked
-                        {
-                            while (await e.MoveNext(cancellationToken)
-                                          .ConfigureAwait(false))
-                            {
-                                v = e.Current;
-                                if (v.HasValue)
-                                {
-                                    sum += v.GetValueOrDefault();
-                                    ++count;
-                                }
-                            }
-                        }
-
-                        return (double)sum / count;
-                    }
-                }
-            }
-
-            return null;
-        }
-
-        private static async Task<double> Average_(IAsyncEnumerable<long> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                if (!await e.MoveNext(cancellationToken)
-                            .ConfigureAwait(false))
-                {
-                    throw new InvalidOperationException(Strings.NO_ELEMENTS);
-                }
-
-                var sum = e.Current;
-                long count = 1;
-                checked
-                {
-                    while (await e.MoveNext(cancellationToken)
-                                  .ConfigureAwait(false))
-                    {
-                        sum += e.Current;
-                        ++count;
-                    }
-                }
-
-                return (double)sum / count;
-            }
-        }
-
-        private static async Task<double?> Average_(IAsyncEnumerable<long?> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    var v = e.Current;
-                    if (v.HasValue)
-                    {
-                        var sum = v.GetValueOrDefault();
-                        long count = 1;
-                        checked
-                        {
-                            while (await e.MoveNext(cancellationToken)
-                                          .ConfigureAwait(false))
-                            {
-                                v = e.Current;
-                                if (v.HasValue)
-                                {
-                                    sum += v.GetValueOrDefault();
-                                    ++count;
-                                }
-                            }
-                        }
-
-                        return (double)sum / count;
-                    }
-                }
-            }
-
-            return null;
-        }
-
-        private static async Task<double> Average_(IAsyncEnumerable<double> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                if (!await e.MoveNext(cancellationToken)
-                            .ConfigureAwait(false))
-                {
-                    throw new InvalidOperationException(Strings.NO_ELEMENTS);
-                }
-
-                var sum = e.Current;
-                long count = 1;
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    // There is an opportunity to short-circuit here, in that if e.Current is
-                    // ever NaN then the result will always be NaN. Assuming that this case is
-                    // rare enough that not checking is the better approach generally.
-                    sum += e.Current;
-                    ++count;
-                }
-
-                return sum / count;
-            }
-        }
-
-        private static async Task<double?> Average_(IAsyncEnumerable<double?> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    var v = e.Current;
-                    if (v.HasValue)
-                    {
-                        var sum = v.GetValueOrDefault();
-                        long count = 1;
-                        checked
-                        {
-                            while (await e.MoveNext(cancellationToken)
-                                          .ConfigureAwait(false))
-                            {
-                                v = e.Current;
-                                if (v.HasValue)
-                                {
-                                    sum += v.GetValueOrDefault();
-                                    ++count;
-                                }
-                            }
-                        }
-
-                        return sum / count;
-                    }
-                }
-            }
-
-            return null;
-        }
-
-        private static async Task<float> Average_(IAsyncEnumerable<float> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                if (!await e.MoveNext(cancellationToken)
-                            .ConfigureAwait(false))
-                {
-                    throw new InvalidOperationException(Strings.NO_ELEMENTS);
-                }
-
-                double sum = e.Current;
-                long count = 1;
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    sum += e.Current;
-                    ++count;
-                }
-
-                return (float)(sum / count);
-            }
-        }
-
-        private static async Task<float?> Average_(IAsyncEnumerable<float?> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    var v = e.Current;
-                    if (v.HasValue)
-                    {
-                        double sum = v.GetValueOrDefault();
-                        long count = 1;
-                        checked
-                        {
-                            while (await e.MoveNext(cancellationToken)
-                                          .ConfigureAwait(false))
-                            {
-                                v = e.Current;
-                                if (v.HasValue)
-                                {
-                                    sum += v.GetValueOrDefault();
-                                    ++count;
-                                }
-                            }
-                        }
-
-                        return (float)(sum / count);
-                    }
-                }
-            }
-
-            return null;
-        }
-
-        private static async Task<decimal> Average_(IAsyncEnumerable<decimal> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                if (!await e.MoveNext(cancellationToken)
-                            .ConfigureAwait(false))
-                {
-                    throw new InvalidOperationException(Strings.NO_ELEMENTS);
-                }
-
-                var sum = e.Current;
-                long count = 1;
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    sum += e.Current;
-                    ++count;
-                }
-
-                return sum / count;
-            }
-        }
-
-        private static async Task<decimal?> Average_(IAsyncEnumerable<decimal?> source, CancellationToken cancellationToken)
-        {
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    var v = e.Current;
-                    if (v.HasValue)
-                    {
-                        var sum = v.GetValueOrDefault();
-                        long count = 1;
-                        while (await e.MoveNext(cancellationToken)
-                                      .ConfigureAwait(false))
-                        {
-                            v = e.Current;
-                            if (v.HasValue)
-                            {
-                                sum += v.GetValueOrDefault();
-                                ++count;
-                            }
-                        }
-
-                        return sum / count;
-                    }
-                }
-            }
-
-            return null;
-        }
-    }
-}

+ 0 - 152
Ix.NET/Source/System.Interactive.Async/Buffer.cs

@@ -1,152 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<IList<TSource>> Buffer<TSource>(this IAsyncEnumerable<TSource> source, int count)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (count <= 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(count));
-            }
-
-            return new BufferAsyncIterator<TSource>(source, count, count);
-        }
-
-        public static IAsyncEnumerable<IList<TSource>> Buffer<TSource>(this IAsyncEnumerable<TSource> source, int count, int skip)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (count <= 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(count));
-            }
-
-            if (skip <= 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(skip));
-            }
-
-            return new BufferAsyncIterator<TSource>(source, count, skip);
-        }
-
-        private sealed class BufferAsyncIterator<TSource> : AsyncIterator<IList<TSource>>
-        {
-            private readonly int count;
-            private readonly int skip;
-            private readonly IAsyncEnumerable<TSource> source;
-
-            private Queue<IList<TSource>> buffers;
-            private IAsyncEnumerator<TSource> enumerator;
-            private int index;
-            private bool stopped;
-
-            public BufferAsyncIterator(IAsyncEnumerable<TSource> source, int count, int skip)
-            {
-                Debug.Assert(source != null);
-
-                this.source = source;
-                this.count = count;
-                this.skip = skip;
-            }
-
-            public override AsyncIterator<IList<TSource>> Clone()
-            {
-                return new BufferAsyncIterator<TSource>(source, count, skip);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                }
-
-                buffers = null;
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        buffers = new Queue<IList<TSource>>();
-                        index = 0;
-                        stopped = false;
-
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        while (true)
-                        {
-                            if (!stopped)
-                            {
-                                if (await enumerator.MoveNext(cancellationToken)
-                                                    .ConfigureAwait(false))
-                                {
-                                    var item = enumerator.Current;
-                                    if (index++ % skip == 0)
-                                    {
-                                        buffers.Enqueue(new List<TSource>(count));
-                                    }
-
-                                    foreach (var buffer in buffers)
-                                    {
-                                        buffer.Add(item);
-                                    }
-
-                                    if (buffers.Count > 0 && buffers.Peek()
-                                                                    .Count == count)
-                                    {
-                                        current = buffers.Dequeue();
-                                        return true;
-                                    }
-
-                                    continue; // loop
-                                }
-                                stopped = true;
-                                enumerator.Dispose();
-                                enumerator = null;
-
-                                continue; // loop
-                            }
-
-                            if (buffers.Count > 0)
-                            {
-                                current = buffers.Dequeue();
-                                return true;
-                            }
-
-                            break; // exit the while
-                        }
-
-                        break; // case
-                }
-
-                Dispose();
-                return false;
-            }
-        }
-    }
-}

+ 0 - 38
Ix.NET/Source/System.Interactive.Async/Cast.cs

@@ -1,38 +0,0 @@
-// // Licensed to the .NET Foundation under one or more agreements.
-// // 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.Collections.Generic;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TResult> Cast<TResult>(this IAsyncEnumerable<object> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            // Check to see if it already is and short-circuit
-            if (source is IAsyncEnumerable<TResult> typedSource)
-            {
-                return typedSource;
-            }
-
-            return source.Select(x => (TResult)x);
-        }
-
-        public static IAsyncEnumerable<TType> OfType<TType>(this IAsyncEnumerable<object> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return source.Where(x => x is TType)
-                         .Cast<TType>();
-        }
-    }
-}

+ 0 - 256
Ix.NET/Source/System.Interactive.Async/Catch.cs

@@ -1,256 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.ExceptionServices;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> Catch<TSource, TException>(this IAsyncEnumerable<TSource> source, Func<TException, IAsyncEnumerable<TSource>> handler)
-            where TException : Exception
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (handler == null)
-            {
-                throw new ArgumentNullException(nameof(handler));
-            }
-
-            return new CatchAsyncIterator<TSource, TException>(source, handler);
-        }
-
-        public static IAsyncEnumerable<TSource> Catch<TSource>(this IEnumerable<IAsyncEnumerable<TSource>> sources)
-        {
-            if (sources == null)
-            {
-                throw new ArgumentNullException(nameof(sources));
-            }
-
-            return sources.Catch_();
-        }
-
-        public static IAsyncEnumerable<TSource> Catch<TSource>(params IAsyncEnumerable<TSource>[] sources)
-        {
-            if (sources == null)
-            {
-                throw new ArgumentNullException(nameof(sources));
-            }
-
-            return sources.Catch_();
-        }
-
-        public static IAsyncEnumerable<TSource> Catch<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second)
-        {
-            if (first == null)
-            {
-                throw new ArgumentNullException(nameof(first));
-            }
-
-            if (second == null)
-            {
-                throw new ArgumentNullException(nameof(second));
-            }
-
-            return new[] { first, second }.Catch_();
-        }
-
-        private static IAsyncEnumerable<TSource> Catch_<TSource>(this IEnumerable<IAsyncEnumerable<TSource>> sources)
-        {
-            return new CatchAsyncIterator<TSource>(sources);
-        }
-
-        private sealed class CatchAsyncIterator<TSource, TException> : AsyncIterator<TSource> where TException : Exception
-        {
-            private readonly Func<TException, IAsyncEnumerable<TSource>> handler;
-            private readonly IAsyncEnumerable<TSource> source;
-
-            private IAsyncEnumerator<TSource> enumerator;
-            private bool isDone;
-
-            public CatchAsyncIterator(IAsyncEnumerable<TSource> source, Func<TException, IAsyncEnumerable<TSource>> handler)
-            {
-                Debug.Assert(source != null);
-                Debug.Assert(handler != null);
-
-                this.source = source;
-                this.handler = handler;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new CatchAsyncIterator<TSource, TException>(source, handler);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                }
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        isDone = false;
-
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        while (true)
-                        {
-                            if (!isDone)
-                            {
-                                try
-                                {
-                                    if (await enumerator.MoveNext(cancellationToken)
-                                                        .ConfigureAwait(false))
-                                    {
-                                        current = enumerator.Current;
-                                        return true;
-                                    }
-                                }
-                                catch (TException ex)
-                                {
-                                    // Note: Ideally we'd dispose of the previous enumerator before
-                                    // invoking the handler, but we use this order to preserve
-                                    // current behavior
-                                    var err = handler(ex)
-                                        .GetEnumerator();
-                                    enumerator?.Dispose();
-                                    enumerator = err;
-                                    isDone = true;
-                                    continue; // loop so we hit the catch state
-                                }
-                            }
-
-                            if (await enumerator.MoveNext(cancellationToken)
-                                                .ConfigureAwait(false))
-                            {
-                                current = enumerator.Current;
-                                return true;
-                            }
-
-                            break; // while
-                        }
-
-                        break; // case
-                }
-
-                Dispose();
-                return false;
-            }
-        }
-
-        private sealed class CatchAsyncIterator<TSource> : AsyncIterator<TSource>
-        {
-            private readonly IEnumerable<IAsyncEnumerable<TSource>> sources;
-
-            private IAsyncEnumerator<TSource> enumerator;
-            private ExceptionDispatchInfo error;
-
-            private IEnumerator<IAsyncEnumerable<TSource>> sourcesEnumerator;
-
-            public CatchAsyncIterator(IEnumerable<IAsyncEnumerable<TSource>> sources)
-            {
-                Debug.Assert(sources != null);
-
-                this.sources = sources;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new CatchAsyncIterator<TSource>(sources);
-            }
-
-            public override void Dispose()
-            {
-                if (sourcesEnumerator != null)
-                {
-                    sourcesEnumerator.Dispose();
-                    sourcesEnumerator = null;
-                }
-
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                }
-
-                error = null;
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        sourcesEnumerator = sources.GetEnumerator();
-
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        while (true)
-                        {
-                            if (enumerator == null)
-                            {
-                                if (!sourcesEnumerator.MoveNext())
-                                {
-                                    // only throw if we have an error on the last one
-                                    error?.Throw();
-                                    break; // done, nothing else to do
-                                }
-
-                                error = null;
-                                enumerator = sourcesEnumerator.Current.GetEnumerator();
-                            }
-
-                            try
-                            {
-                                if (await enumerator.MoveNext(cancellationToken)
-                                                    .ConfigureAwait(false))
-                                {
-                                    current = enumerator.Current;
-                                    return true;
-                                }
-                            }
-                            catch (Exception ex)
-                            {
-                                // Done with the current one, go to the next
-                                enumerator.Dispose();
-                                enumerator = null;
-                                error = ExceptionDispatchInfo.Capture(ex);
-                                continue;
-                            }
-
-                            break; // while
-                        }
-
-                        break; // case
-                }
-
-                Dispose();
-                return false;
-            }
-        }
-    }
-}

+ 0 - 63
Ix.NET/Source/System.Interactive.Async/Contains.cs

@@ -1,63 +0,0 @@
-// // Licensed to the .NET Foundation under one or more agreements.
-// // 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static Task<bool> Contains<TSource>(this IAsyncEnumerable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (comparer == null)
-            {
-                throw new ArgumentNullException(nameof(comparer));
-            }
-
-            return Contains(source, value, comparer, CancellationToken.None);
-        }
-
-        public static Task<bool> Contains<TSource>(this IAsyncEnumerable<TSource> source, TSource value)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Contains(source, value, CancellationToken.None);
-        }
-
-        public static Task<bool> Contains<TSource>(this IAsyncEnumerable<TSource> source, TSource value, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (comparer == null)
-            {
-                throw new ArgumentNullException(nameof(comparer));
-            }
-
-            return source.Any(x => comparer.Equals(x, value), cancellationToken);
-        }
-
-        public static Task<bool> Contains<TSource>(this IAsyncEnumerable<TSource> source, TSource value, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return source.Contains(value, EqualityComparer<TSource>.Default, cancellationToken);
-        }
-    }
-}

+ 0 - 125
Ix.NET/Source/System.Interactive.Async/Count.cs

@@ -1,125 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static Task<int> Count<TSource>(this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (source is ICollection<TSource> collection)
-            {
-                return Task.FromResult(collection.Count);
-            }
-
-            if (source is IIListProvider<TSource> listProv)
-            {
-                return listProv.GetCountAsync(false, cancellationToken);
-            }
-
-            return source.Aggregate(0, (c, _) => checked(c + 1), cancellationToken);
-        }
-
-        public static Task<int> Count<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return source.Where(predicate)
-                         .Aggregate(0, (c, _) => checked(c + 1), cancellationToken);
-        }
-
-        public static Task<int> Count<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return Count(source, CancellationToken.None);
-        }
-
-        public static Task<int> Count<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return Count(source, predicate, CancellationToken.None);
-        }
-
-        public static Task<long> LongCount<TSource>(this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return source.Aggregate(0L, (c, _) => checked(c + 1), cancellationToken);
-        }
-
-        public static Task<long> LongCount<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return source.Where(predicate)
-                         .Aggregate(0L, (c, _) => checked(c + 1), cancellationToken);
-        }
-
-        public static Task<long> LongCount<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return LongCount(source, CancellationToken.None);
-        }
-
-        public static Task<long> LongCount<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return LongCount(source, predicate, CancellationToken.None);
-        }
-    }
-}

+ 0 - 131
Ix.NET/Source/System.Interactive.Async/Create.cs

@@ -1,131 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<T> CreateEnumerable<T>(Func<IAsyncEnumerator<T>> getEnumerator)
-        {
-            if (getEnumerator == null)
-            {
-                throw new ArgumentNullException(nameof(getEnumerator));
-            }
-
-            return new AnonymousAsyncEnumerable<T>(getEnumerator);
-        }
-
-        public static IAsyncEnumerator<T> CreateEnumerator<T>(Func<CancellationToken, Task<bool>> moveNext, Func<T> current, Action dispose)
-        {
-            if (moveNext == null)
-            {
-                throw new ArgumentNullException(nameof(moveNext));
-            }
-
-            // Note: Many methods pass null in for the second two parameters. We're assuming
-            // That the caller is responsible and knows what they're doing
-            return new AnonymousAsyncIterator<T>(moveNext, current, dispose);
-        }
-
-        private static IAsyncEnumerator<T> CreateEnumerator<T>(Func<CancellationToken, TaskCompletionSource<bool>, Task<bool>> moveNext, Func<T> current, Action dispose)
-        {
-            var self = new AnonymousAsyncIterator<T>(
-                async ct =>
-                {
-                    var tcs = new TaskCompletionSource<bool>();
-
-                    var stop = new Action(
-                        () =>
-                        {
-                            tcs.TrySetCanceled();
-                        });
-
-                    using (ct.Register(stop))
-                    {
-                        return await moveNext(ct, tcs)
-                                   .ConfigureAwait(false);
-                    }
-                },
-                current,
-                dispose
-            );
-            return self;
-        }
-
-        private class AnonymousAsyncEnumerable<T> : IAsyncEnumerable<T>
-        {
-            private readonly Func<IAsyncEnumerator<T>> getEnumerator;
-
-            public AnonymousAsyncEnumerable(Func<IAsyncEnumerator<T>> getEnumerator)
-            {
-                Debug.Assert(getEnumerator != null);
-
-                this.getEnumerator = getEnumerator;
-            }
-
-            public IAsyncEnumerator<T> GetEnumerator()
-            {
-                return getEnumerator();
-            }
-        }
-
-        private sealed class AnonymousAsyncIterator<T> : AsyncIterator<T>
-        {
-            private readonly Func<T> currentFunc;
-            private readonly Func<CancellationToken, Task<bool>> moveNext;
-            private Action dispose;
-
-
-            public AnonymousAsyncIterator(Func<CancellationToken, Task<bool>> moveNext, Func<T> currentFunc, Action dispose)
-            {
-                Debug.Assert(moveNext != null);
-
-                this.moveNext = moveNext;
-                this.currentFunc = currentFunc;
-                Volatile.Write(ref this.dispose, dispose);
-
-                // Explicit call to initialize enumerator mode
-                GetEnumerator();
-            }
-
-            public override AsyncIterator<T> Clone()
-            {
-                throw new NotSupportedException("AnonymousAsyncIterator cannot be cloned. It is only intended for use as an iterator.");
-            }
-
-            public override void Dispose()
-            {
-                Interlocked.Exchange(ref this.dispose, null)?.Invoke();
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        if (await moveNext(cancellationToken).ConfigureAwait(false))
-                        {
-                            current = currentFunc();
-                            return true;
-                        }
-
-                        Dispose();
-                        break;
-                }
-
-                return false;
-            }
-        }
-    }
-}

+ 0 - 136
Ix.NET/Source/System.Interactive.Async/DefaultIfEmpty.cs

@@ -1,136 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> DefaultIfEmpty<TSource>(this IAsyncEnumerable<TSource> source, TSource defaultValue)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return new DefaultIfEmptyAsyncIterator<TSource>(source, defaultValue);
-        }
-
-        public static IAsyncEnumerable<TSource> DefaultIfEmpty<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return DefaultIfEmpty(source, default);
-        }
-
-        private sealed class DefaultIfEmptyAsyncIterator<TSource> : AsyncIterator<TSource>, IIListProvider<TSource>
-        {
-            private readonly IAsyncEnumerable<TSource> source;
-            private readonly TSource defaultValue;
-
-            private IAsyncEnumerator<TSource> enumerator;
-
-            public DefaultIfEmptyAsyncIterator(IAsyncEnumerable<TSource> source, TSource defaultValue)
-            {
-                Debug.Assert(source != null);
-
-                this.source = source;
-                this.defaultValue = defaultValue;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new DefaultIfEmptyAsyncIterator<TSource>(source, defaultValue);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                }
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        if (await enumerator.MoveNext(cancellationToken)
-                                            .ConfigureAwait(false))
-                        {
-                            current = enumerator.Current;
-                            state = AsyncIteratorState.Iterating;
-                        }
-                        else
-                        {
-                            current = defaultValue;
-                            enumerator.Dispose();
-                            enumerator = null;
-
-                            state = AsyncIteratorState.Disposed;
-                        }
-                        return true;
-
-                    case AsyncIteratorState.Iterating:
-                        if (await enumerator.MoveNext(cancellationToken)
-                                            .ConfigureAwait(false))
-                        {
-                            current = enumerator.Current;
-                            return true;
-                        }
-                        break;
-                }
-
-                Dispose();
-                return false;
-            }
-
-            public async Task<TSource[]> ToArrayAsync(CancellationToken cancellationToken)
-            {
-                var array = await source.ToArray(cancellationToken).ConfigureAwait(false);
-                return array.Length == 0 ? new[] { defaultValue } : array;
-            }
-
-            public async Task<List<TSource>> ToListAsync(CancellationToken cancellationToken)
-            {
-                var list = await source.ToList(cancellationToken).ConfigureAwait(false);
-                if (list.Count == 0)
-                {
-                    list.Add(defaultValue);
-                }
-
-                return list;
-            }
-
-            public async Task<int> GetCountAsync(bool onlyIfCheap, CancellationToken cancellationToken)
-            {
-                int count;
-                if (!onlyIfCheap || source is ICollection<TSource> || source is ICollection)
-                {
-                    count = await source.Count(cancellationToken).ConfigureAwait(false);
-                }
-                else
-                {
-                    var listProv = source as IIListProvider<TSource>;
-                    count = listProv == null ? -1 : await listProv.GetCountAsync(onlyIfCheap: true, cancellationToken: cancellationToken).ConfigureAwait(false);
-                }
-
-                return count == 0 ? 1 : count;
-            }
-        }
-    }
-}

+ 0 - 23
Ix.NET/Source/System.Interactive.Async/Defer.cs

@@ -1,23 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> Defer<TSource>(Func<IAsyncEnumerable<TSource>> factory)
-        {
-            if (factory == null)
-            {
-                throw new ArgumentNullException(nameof(factory));
-            }
-
-            return CreateEnumerable(
-                () => factory()
-                    .GetEnumerator());
-        }
-    }
-}

+ 0 - 527
Ix.NET/Source/System.Interactive.Async/Distinct.cs

@@ -1,527 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (keySelector == null)
-            {
-                throw new ArgumentNullException(nameof(keySelector));
-            }
-
-            if (comparer == null)
-            {
-                throw new ArgumentNullException(nameof(comparer));
-            }
-
-            return new DistinctAsyncIterator<TSource, TKey>(source, keySelector, comparer);
-        }
-
-        public static IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (keySelector == null)
-            {
-                throw new ArgumentNullException(nameof(keySelector));
-            }
-
-            return source.Distinct(keySelector, EqualityComparer<TKey>.Default);
-        }
-
-        public static IAsyncEnumerable<TSource> Distinct<TSource>(this IAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (comparer == null)
-            {
-                throw new ArgumentNullException(nameof(comparer));
-            }
-
-            return new DistinctAsyncIterator<TSource>(source, comparer);
-        }
-
-        public static IAsyncEnumerable<TSource> Distinct<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return source.Distinct(EqualityComparer<TSource>.Default);
-        }
-
-        public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return source.DistinctUntilChanged(EqualityComparer<TSource>.Default);
-        }
-
-        public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource>(this IAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (comparer == null)
-            {
-                throw new ArgumentNullException(nameof(comparer));
-            }
-
-            return new DistinctUntilChangedAsyncIterator<TSource>(source, comparer);
-        }
-
-        public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (keySelector == null)
-            {
-                throw new ArgumentNullException(nameof(keySelector));
-            }
-
-            return source.DistinctUntilChanged_(keySelector, EqualityComparer<TKey>.Default);
-        }
-
-        public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (keySelector == null)
-            {
-                throw new ArgumentNullException(nameof(keySelector));
-            }
-
-            if (comparer == null)
-            {
-                throw new ArgumentNullException(nameof(comparer));
-            }
-
-            return source.DistinctUntilChanged_(keySelector, comparer);
-        }
-
-        private static IAsyncEnumerable<TSource> DistinctUntilChanged_<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
-        {
-            return new DistinctUntilChangedAsyncIterator<TSource, TKey>(source, keySelector, comparer);
-        }
-
-        private sealed class DistinctAsyncIterator<TSource, TKey> : AsyncIterator<TSource>, IIListProvider<TSource>
-        {
-            private readonly IEqualityComparer<TKey> comparer;
-            private readonly Func<TSource, TKey> keySelector;
-            private readonly IAsyncEnumerable<TSource> source;
-
-            private IAsyncEnumerator<TSource> enumerator;
-            private Set<TKey> set;
-
-            public DistinctAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
-            {
-                Debug.Assert(source != null);
-                Debug.Assert(keySelector != null);
-                Debug.Assert(comparer != null);
-
-                this.source = source;
-                this.keySelector = keySelector;
-                this.comparer = comparer;
-            }
-
-            public async Task<TSource[]> ToArrayAsync(CancellationToken cancellationToken)
-            {
-                var s = await FillSet(cancellationToken)
-                            .ConfigureAwait(false);
-                return s.ToArray();
-            }
-
-            public async Task<List<TSource>> ToListAsync(CancellationToken cancellationToken)
-            {
-                var s = await FillSet(cancellationToken)
-                            .ConfigureAwait(false);
-                return s;
-            }
-
-            public async Task<int> GetCountAsync(bool onlyIfCheap, CancellationToken cancellationToken)
-            {
-                if (onlyIfCheap)
-                {
-                    return -1;
-                }
-
-                var count = 0;
-                var s = new Set<TKey>(comparer);
-                using (var enu = source.GetEnumerator())
-                {
-                    while (await enu.MoveNext(cancellationToken)
-                                    .ConfigureAwait(false))
-                    {
-                        var item = enu.Current;
-                        if (s.Add(keySelector(item)))
-                        {
-                            count++;
-                        }
-                    }
-                }
-
-                return count;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new DistinctAsyncIterator<TSource, TKey>(source, keySelector, comparer);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                    set = null;
-                }
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        if (!await enumerator.MoveNext(cancellationToken)
-                                             .ConfigureAwait(false))
-                        {
-                            Dispose();
-                            return false;
-                        }
-
-                        var element = enumerator.Current;
-                        set = new Set<TKey>(comparer);
-                        set.Add(keySelector(element));
-                        current = element;
-                        state = AsyncIteratorState.Iterating;
-                        return true;
-
-                    case AsyncIteratorState.Iterating:
-                        while (await enumerator.MoveNext(cancellationToken)
-                                               .ConfigureAwait(false))
-                        {
-                            element = enumerator.Current;
-                            if (set.Add(keySelector(element)))
-                            {
-                                current = element;
-                                return true;
-                            }
-                        }
-
-                        break;
-                }
-
-                Dispose();
-                return false;
-            }
-
-            private async Task<List<TSource>> FillSet(CancellationToken cancellationToken)
-            {
-                var s = new Set<TKey>(comparer);
-                var r = new List<TSource>();
-                using (var enu = source.GetEnumerator())
-                {
-                    while (await enu.MoveNext(cancellationToken)
-                                    .ConfigureAwait(false))
-                    {
-                        var item = enu.Current;
-                        if (s.Add(keySelector(item)))
-                        {
-                            r.Add(item);
-                        }
-                    }
-                }
-
-                return r;
-            }
-        }
-
-        private sealed class DistinctAsyncIterator<TSource> : AsyncIterator<TSource>, IIListProvider<TSource>
-        {
-            private readonly IEqualityComparer<TSource> comparer;
-            private readonly IAsyncEnumerable<TSource> source;
-
-            private IAsyncEnumerator<TSource> enumerator;
-            private Set<TSource> set;
-
-            public DistinctAsyncIterator(IAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
-            {
-                Debug.Assert(source != null);
-
-                this.source = source;
-                this.comparer = comparer;
-            }
-
-            public async Task<TSource[]> ToArrayAsync(CancellationToken cancellationToken)
-            {
-                var s = await FillSet(cancellationToken)
-                            .ConfigureAwait(false);
-                return s.ToArray();
-            }
-
-            public async Task<List<TSource>> ToListAsync(CancellationToken cancellationToken)
-            {
-                var s = await FillSet(cancellationToken)
-                            .ConfigureAwait(false);
-                return s.ToList();
-            }
-
-            public async Task<int> GetCountAsync(bool onlyIfCheap, CancellationToken cancellationToken)
-            {
-                return onlyIfCheap ? -1 : (await FillSet(cancellationToken)
-                                               .ConfigureAwait(false)).Count;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new DistinctAsyncIterator<TSource>(source, comparer);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                    set = null;
-                }
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        if (!await enumerator.MoveNext(cancellationToken)
-                                             .ConfigureAwait(false))
-                        {
-                            Dispose();
-                            return false;
-                        }
-
-                        var element = enumerator.Current;
-                        set = new Set<TSource>(comparer);
-                        set.Add(element);
-                        current = element;
-                        state = AsyncIteratorState.Iterating;
-                        return true;
-
-                    case AsyncIteratorState.Iterating:
-                        while (await enumerator.MoveNext(cancellationToken)
-                                               .ConfigureAwait(false))
-                        {
-                            element = enumerator.Current;
-                            if (set.Add(element))
-                            {
-                                current = element;
-                                return true;
-                            }
-                        }
-
-                        break;
-                }
-
-                Dispose();
-                return false;
-            }
-
-            private async Task<Set<TSource>> FillSet(CancellationToken cancellationToken)
-            {
-                var s = new Set<TSource>(comparer);
-                using (var enu = source.GetEnumerator())
-                {
-                    while (await enu.MoveNext(cancellationToken)
-                                    .ConfigureAwait(false))
-                    {
-                        s.Add(enu.Current);
-                    }
-                }
-
-                return s;
-            }
-        }
-
-        private sealed class DistinctUntilChangedAsyncIterator<TSource> : AsyncIterator<TSource>
-        {
-            private readonly IEqualityComparer<TSource> comparer;
-            private readonly IAsyncEnumerable<TSource> source;
-
-            private TSource currentValue;
-            private IAsyncEnumerator<TSource> enumerator;
-            private bool hasCurrentValue;
-
-            public DistinctUntilChangedAsyncIterator(IAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
-            {
-                Debug.Assert(comparer != null);
-                Debug.Assert(source != null);
-
-                this.source = source;
-                this.comparer = comparer;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new DistinctUntilChangedAsyncIterator<TSource>(source, comparer);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                    currentValue = default;
-                }
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        while (await enumerator.MoveNext(cancellationToken)
-                                            .ConfigureAwait(false))
-                        {
-                            var item = enumerator.Current;
-                            var comparerEquals = false;
-
-                            if (hasCurrentValue)
-                            {
-                                comparerEquals = comparer.Equals(currentValue, item);
-                            }
-                            if (!hasCurrentValue || !comparerEquals)
-                            {
-                                hasCurrentValue = true;
-                                currentValue = item;
-                                current = item;
-                                return true;
-                            }
-                        }
-
-                        break;
-                }
-
-                Dispose();
-                return false;
-            }
-        }
-
-        private sealed class DistinctUntilChangedAsyncIterator<TSource, TKey> : AsyncIterator<TSource>
-        {
-            private readonly IEqualityComparer<TKey> comparer;
-            private readonly Func<TSource, TKey> keySelector;
-            private readonly IAsyncEnumerable<TSource> source;
-            private TKey currentKeyValue;
-
-            private IAsyncEnumerator<TSource> enumerator;
-            private bool hasCurrentKey;
-
-            public DistinctUntilChangedAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
-            {
-                this.source = source;
-                this.keySelector = keySelector;
-                this.comparer = comparer;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new DistinctUntilChangedAsyncIterator<TSource, TKey>(source, keySelector, comparer);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                    currentKeyValue = default;
-                }
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        while (await enumerator.MoveNext(cancellationToken)
-                                               .ConfigureAwait(false))
-                        {
-                            var item = enumerator.Current;
-                            var key = keySelector(item);
-                            var comparerEquals = false;
-
-                            if (hasCurrentKey)
-                            {
-                                comparerEquals = comparer.Equals(currentKeyValue, key);
-                            }
-                            if (!hasCurrentKey || !comparerEquals)
-                            {
-                                hasCurrentKey = true;
-                                currentKeyValue = key;
-                                current = item;
-                                return true;
-                            }
-                        }
-
-                        break; // case
-                }
-
-                Dispose();
-                return false;
-            }
-        }
-    }
-}

+ 0 - 191
Ix.NET/Source/System.Interactive.Async/Do.cs

@@ -1,191 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> Do<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> onNext)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (onNext == null)
-            {
-                throw new ArgumentNullException(nameof(onNext));
-            }
-
-            return DoHelper(source, onNext, null, null);
-        }
-
-        public static IAsyncEnumerable<TSource> Do<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> onNext, Action onCompleted)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (onNext == null)
-            {
-                throw new ArgumentNullException(nameof(onNext));
-            }
-
-            if (onCompleted == null)
-            {
-                throw new ArgumentNullException(nameof(onCompleted));
-            }
-
-            return DoHelper(source, onNext, null, onCompleted);
-        }
-
-        public static IAsyncEnumerable<TSource> Do<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (onNext == null)
-            {
-                throw new ArgumentNullException(nameof(onNext));
-            }
-
-            if (onError == null)
-            {
-                throw new ArgumentNullException(nameof(onError));
-            }
-
-            return DoHelper(source, onNext, onError, null);
-        }
-
-        public static IAsyncEnumerable<TSource> Do<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (onNext == null)
-            {
-                throw new ArgumentNullException(nameof(onNext));
-            }
-
-            if (onError == null)
-            {
-                throw new ArgumentNullException(nameof(onError));
-            }
-
-            if (onCompleted == null)
-            {
-                throw new ArgumentNullException(nameof(onCompleted));
-            }
-
-            return DoHelper(source, onNext, onError, onCompleted);
-        }
-
-        public static IAsyncEnumerable<TSource> Do<TSource>(this IAsyncEnumerable<TSource> source, IObserver<TSource> observer)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (observer == null)
-            {
-                throw new ArgumentNullException(nameof(observer));
-            }
-
-            return DoHelper(source, observer.OnNext, observer.OnError, observer.OnCompleted);
-        }
-
-        private static IAsyncEnumerable<TSource> DoHelper<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
-        {
-            return new DoAsyncIterator<TSource>(source, onNext, onError, onCompleted);
-        }
-
-        private sealed class DoAsyncIterator<TSource> : AsyncIterator<TSource>
-        {
-            private readonly Action onCompleted;
-            private readonly Action<Exception> onError;
-            private readonly Action<TSource> onNext;
-            private readonly IAsyncEnumerable<TSource> source;
-
-            private IAsyncEnumerator<TSource> enumerator;
-
-            public DoAsyncIterator(IAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
-            {
-                Debug.Assert(source != null);
-                Debug.Assert(onNext != null);
-
-                this.source = source;
-                this.onNext = onNext;
-                this.onError = onError;
-                this.onCompleted = onCompleted;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new DoAsyncIterator<TSource>(source, onNext, onError, onCompleted);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                }
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        try
-                        {
-                            if (await enumerator.MoveNext(cancellationToken)
-                                                .ConfigureAwait(false))
-                            {
-                                current = enumerator.Current;
-                                onNext(current);
-
-                                return true;
-                            }
-                        }
-                        catch (OperationCanceledException)
-                        {
-                            throw;
-                        }
-                        catch (Exception ex)
-                        {
-                            onError?.Invoke(ex);
-                            throw;
-                        }
-
-                        onCompleted?.Invoke();
-
-                        Dispose();
-                        break;
-                }
-
-                return false;
-            }
-        }
-    }
-}

+ 0 - 113
Ix.NET/Source/System.Interactive.Async/ElementAt.cs

@@ -1,113 +0,0 @@
-// // Licensed to the .NET Foundation under one or more agreements.
-// // 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static Task<TSource> ElementAt<TSource>(this IAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (index < 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(index));
-            }
-
-            return ElementAt_(source, index, cancellationToken);
-        }
-
-
-        public static Task<TSource> ElementAt<TSource>(this IAsyncEnumerable<TSource> source, int index)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return ElementAt(source, index, CancellationToken.None);
-        }
-
-        public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (index < 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(index));
-            }
-
-            return ElementAtOrDefault_(source, index, cancellationToken);
-        }
-
-        public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncEnumerable<TSource> source, int index)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return ElementAtOrDefault(source, index, CancellationToken.None);
-        }
-
-        private static async Task<TSource> ElementAt_<TSource>(IAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken)
-        {
-            if (source is IList<TSource> list)
-            {
-                return list[index];
-            }
-
-            if (index >= 0)
-            {
-                using (var e = source.GetEnumerator())
-                {
-                    while (await e.MoveNext(cancellationToken)
-                                  .ConfigureAwait(false))
-                    {
-                        if (index == 0)
-                        {
-                            return e.Current;
-                        }
-
-                        index--;
-                    }
-                }
-            }
-
-            throw new ArgumentOutOfRangeException(nameof(index));
-        }
-
-        private static async Task<TSource> ElementAtOrDefault_<TSource>(IAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken)
-        {
-            if (index >= 0)
-            {
-                using (var e = source.GetEnumerator())
-                {
-                    while (await e.MoveNext(cancellationToken)
-                                  .ConfigureAwait(false))
-                    {
-                        if (index == 0)
-                        {
-                            return e.Current;
-                        }
-
-                        index--;
-                    }
-                }
-            }
-
-            return default;
-        }
-    }
-}

+ 2 - 4
Ix.NET/Source/System.Interactive.Async/EmptyArray.cs

@@ -1,11 +1,8 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // 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. 
+
 #if NO_ARRAY_EMPTY
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -14,4 +11,5 @@ namespace System.Linq
         public static readonly TElement[] Value = new TElement[0];
     }
 }
+
 #endif

+ 0 - 154
Ix.NET/Source/System.Interactive.Async/Except.cs

@@ -1,154 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> Except<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second)
-        {
-            if (first == null)
-            {
-                throw new ArgumentNullException(nameof(first));
-            }
-
-            if (second == null)
-            {
-                throw new ArgumentNullException(nameof(second));
-            }
-
-            return first.Except(second, EqualityComparer<TSource>.Default);
-        }
-
-        public static IAsyncEnumerable<TSource> Except<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
-        {
-            if (first == null)
-            {
-                throw new ArgumentNullException(nameof(first));
-            }
-
-            if (second == null)
-            {
-                throw new ArgumentNullException(nameof(second));
-            }
-
-            if (comparer == null)
-            {
-                throw new ArgumentNullException(nameof(comparer));
-            }
-
-            return new ExceptAsyncIterator<TSource>(first, second, comparer);
-        }
-
-        private sealed class ExceptAsyncIterator<TSource> : AsyncIterator<TSource>
-        {
-            private readonly IEqualityComparer<TSource> comparer;
-            private readonly IAsyncEnumerable<TSource> first;
-            private readonly IAsyncEnumerable<TSource> second;
-
-            private Task fillSetTask;
-
-            private IAsyncEnumerator<TSource> firstEnumerator;
-            private Set<TSource> set;
-
-            private bool setFilled;
-
-            public ExceptAsyncIterator(IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
-            {
-                Debug.Assert(first != null);
-                Debug.Assert(second != null);
-                Debug.Assert(comparer != null);
-
-                this.first = first;
-                this.second = second;
-                this.comparer = comparer;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new ExceptAsyncIterator<TSource>(first, second, comparer);
-            }
-
-            public override void Dispose()
-            {
-                if (firstEnumerator != null)
-                {
-                    firstEnumerator.Dispose();
-                    firstEnumerator = null;
-                }
-
-                set = null;
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        firstEnumerator = first.GetEnumerator();
-                        set = new Set<TSource>(comparer);
-                        setFilled = false;
-                        fillSetTask = FillSet(cancellationToken);
-
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        bool moveNext;
-                        do
-                        {
-                            if (!setFilled)
-                            {
-                                // This is here so we don't need to call Task.WhenAll each time after the set is filled
-                                var moveNextTask = firstEnumerator.MoveNext(cancellationToken);
-                                await Task.WhenAll(moveNextTask, fillSetTask)
-                                          .ConfigureAwait(false);
-                                setFilled = true;
-                                moveNext = moveNextTask.Result;
-                            }
-                            else
-                            {
-                                moveNext = await firstEnumerator.MoveNext(cancellationToken)
-                                                                .ConfigureAwait(false);
-                            }
-
-                            if (moveNext)
-                            {
-                                var item = firstEnumerator.Current;
-                                if (set.Add(item))
-                                {
-                                    current = item;
-                                    return true;
-                                }
-                            }
-
-                        } while (moveNext);
-
-
-                        Dispose();
-                        break;
-                }
-
-                return false;
-            }
-
-            private async Task FillSet(CancellationToken cancellationToken)
-            {
-                var array = await second.ToArray(cancellationToken)
-                                        .ConfigureAwait(false);
-                foreach (var t in array)
-                {
-                    set.Add(t);
-                }
-            }
-        }
-    }
-}

+ 0 - 115
Ix.NET/Source/System.Interactive.Async/Expand.cs

@@ -1,115 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> Expand<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, IAsyncEnumerable<TSource>> selector)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (selector == null)
-            {
-                throw new ArgumentNullException(nameof(selector));
-            }
-
-            return new ExpandAsyncIterator<TSource>(source, selector);
-        }
-
-        private sealed class ExpandAsyncIterator<TSource> : AsyncIterator<TSource>
-        {
-            private readonly Func<TSource, IAsyncEnumerable<TSource>> selector;
-            private readonly IAsyncEnumerable<TSource> source;
-
-            private IAsyncEnumerator<TSource> enumerator;
-
-            private Queue<IAsyncEnumerable<TSource>> queue;
-
-            public ExpandAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, IAsyncEnumerable<TSource>> selector)
-            {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
-                this.source = source;
-                this.selector = selector;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new ExpandAsyncIterator<TSource>(source, selector);
-            }
-
-            public override void Dispose()
-            {
-                if (enumerator != null)
-                {
-                    enumerator.Dispose();
-                    enumerator = null;
-                }
-
-                queue = null;
-
-                base.Dispose();
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        queue = new Queue<IAsyncEnumerable<TSource>>();
-                        queue.Enqueue(source);
-
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        while (true)
-                        {
-                            if (enumerator == null)
-                            {
-                                if (queue.Count > 0)
-                                {
-                                    var src = queue.Dequeue();
-
-                                    enumerator?.Dispose();
-                                    enumerator = src.GetEnumerator();
-
-                                    continue; // loop
-                                }
-
-                                break; // while
-                            }
-
-                            if (await enumerator.MoveNext(cancellationToken)
-                                                .ConfigureAwait(false))
-                            {
-                                var item = enumerator.Current;
-                                var next = selector(item);
-                                queue.Enqueue(next);
-                                current = item;
-                                return true;
-                            }
-                            enumerator.Dispose();
-                            enumerator = null;
-                        }
-
-                        break; // case
-                }
-
-                Dispose();
-                return false;
-            }
-        }
-    }
-}

+ 0 - 116
Ix.NET/Source/System.Interactive.Async/Finally.cs

@@ -1,116 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TSource> Finally<TSource>(this IAsyncEnumerable<TSource> source, Action finallyAction)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (finallyAction == null)
-            {
-                throw new ArgumentNullException(nameof(finallyAction));
-            }
-
-            return new FinallyAsyncIterator<TSource>(source, finallyAction);
-        }
-
-        private sealed class FinallyAsyncIterator<TSource> : AsyncIterator<TSource>
-        {
-            private readonly Action finallyAction;
-            private readonly IAsyncEnumerable<TSource> source;
-
-            private IAsyncEnumerator<TSource> enumerator;
-            private CancellationTokenRegistration _tokenRegistration;
-            private int _once;
-
-            public FinallyAsyncIterator(IAsyncEnumerable<TSource> source, Action finallyAction)
-            {
-                Debug.Assert(source != null);
-                Debug.Assert(finallyAction != null);
-
-                this.source = source;
-                this.finallyAction = finallyAction;
-            }
-
-            public override AsyncIterator<TSource> Clone()
-            {
-                return new FinallyAsyncIterator<TSource>(source, finallyAction);
-            }
-
-            public override void Dispose()
-            {
-                // This could now be executed by either MoveNextCore
-                // or the trigger from a CancellationToken
-                // make sure this happens at most once.
-                if (Interlocked.CompareExchange(ref _once, 1, 0) == 0)
-                {
-                    if (enumerator != null)
-                    {
-                        enumerator.Dispose();
-                        // make sure the clearing of the enumerator
-                        // becomes visible to MoveNextCore
-                        Volatile.Write(ref enumerator, null);
-
-                        finallyAction();
-                    }
-
-                    base.Dispose();
-                    _tokenRegistration.Dispose();
-                }
-            }
-
-            protected override async Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        enumerator = source.GetEnumerator();
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        // clear any previous registration
-                        _tokenRegistration.Dispose();
-                        // and setup a new registration
-                        // we can't know if the token is the same as last time
-                        // note that the registration extends the lifetime of "this"
-                        // so the current AsyncIterator better not be just abandoned
-                        _tokenRegistration = cancellationToken.Register(
-                            state => ((FinallyAsyncIterator<TSource>)state).Dispose(), this);
-
-                        // Now that the CancellationToken may call Dispose
-                        // from any thread while the current thread is in
-                        // MoveNextCore, we must make sure the enumerator
-                        // hasn't been cleared out in the meantime
-                        var en = Volatile.Read(ref enumerator);
-                        if (en != null)
-                        {
-                            if (await en.MoveNext(cancellationToken)
-                                                .ConfigureAwait(false))
-                            {
-                                current = enumerator.Current;
-                                return true;
-                            }
-
-                            Dispose();
-                        }
-                        break;
-                }
-
-                return false;
-            }
-        }
-    }
-}

+ 0 - 153
Ix.NET/Source/System.Interactive.Async/First.cs

@@ -1,153 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static Task<TSource> First<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return First(source, CancellationToken.None);
-        }
-
-        public static Task<TSource> First<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return First(source, predicate, CancellationToken.None);
-        }
-
-        public static Task<TSource> First<TSource>(this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return First_(source, cancellationToken);
-        }
-
-        public static Task<TSource> First<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return source.Where(predicate)
-                         .First(cancellationToken);
-        }
-
-        public static Task<TSource> FirstOrDefault<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return FirstOrDefault(source, CancellationToken.None);
-        }
-
-        public static Task<TSource> FirstOrDefault<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return FirstOrDefault(source, predicate, CancellationToken.None);
-        }
-
-        public static Task<TSource> FirstOrDefault<TSource>(this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            return FirstOrDefault_(source, cancellationToken);
-        }
-
-        public static Task<TSource> FirstOrDefault<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (predicate == null)
-            {
-                throw new ArgumentNullException(nameof(predicate));
-            }
-
-            return source.Where(predicate)
-                         .FirstOrDefault(cancellationToken);
-        }
-
-        private static async Task<TSource> First_<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            var list = source as IList<TSource>;
-            if (list?.Count > 0)
-            {
-                return list[0];
-            }
-
-            using (var e = source.GetEnumerator())
-            {
-                if (await e.MoveNext(cancellationToken)
-                           .ConfigureAwait(false))
-                {
-                    return e.Current;
-                }
-            }
-            throw new InvalidOperationException(Strings.NO_ELEMENTS);
-        }
-
-        private static async Task<TSource> FirstOrDefault_<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
-        {
-            var list = source as IList<TSource>;
-            if (list?.Count > 0)
-            {
-                return list[0];
-            }
-
-            using (var e = source.GetEnumerator())
-            {
-                if (await e.MoveNext(cancellationToken)
-                           .ConfigureAwait(false))
-                {
-                    return e.Current;
-                }
-            }
-            return default;
-        }
-    }
-}

+ 0 - 149
Ix.NET/Source/System.Interactive.Async/ForEach.cs

@@ -1,149 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static void ForEach<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> action)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (action == null)
-            {
-                throw new ArgumentNullException(nameof(action));
-            }
-
-            source.ForEach(action, CancellationToken.None);
-        }
-
-        public static void ForEach<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource, int> action)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (action == null)
-            {
-                throw new ArgumentNullException(nameof(action));
-            }
-
-            source.ForEach(action, CancellationToken.None);
-        }
-
-
-        public static void ForEach<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> action, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (action == null)
-            {
-                throw new ArgumentNullException(nameof(action));
-            }
-
-            source.ForEachAsync(action, cancellationToken)
-                  .Wait(cancellationToken);
-        }
-
-        public static void ForEach<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource, int> action, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (action == null)
-            {
-                throw new ArgumentNullException(nameof(action));
-            }
-
-            source.ForEachAsync(action, cancellationToken)
-                  .Wait(cancellationToken);
-        }
-
-        public static Task ForEachAsync<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> action)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (action == null)
-            {
-                throw new ArgumentNullException(nameof(action));
-            }
-
-            return ForEachAsync(source, action, CancellationToken.None);
-        }
-
-        public static Task ForEachAsync<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource, int> action)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (action == null)
-            {
-                throw new ArgumentNullException(nameof(action));
-            }
-
-            return ForEachAsync(source, action, CancellationToken.None);
-        }
-
-        public static Task ForEachAsync<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource> action, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (action == null)
-            {
-                throw new ArgumentNullException(nameof(action));
-            }
-
-            return source.ForEachAsync((x, i) => action(x), cancellationToken);
-        }
-
-        public static Task ForEachAsync<TSource>(this IAsyncEnumerable<TSource> source, Action<TSource, int> action, CancellationToken cancellationToken)
-        {
-            if (source == null)
-            {
-                throw new ArgumentNullException(nameof(source));
-            }
-
-            if (action == null)
-            {
-                throw new ArgumentNullException(nameof(action));
-            }
-
-            return ForEachAsync_(source, action, cancellationToken);
-        }
-
-        private static async Task ForEachAsync_<TSource>(IAsyncEnumerable<TSource> source, Action<TSource, int> action, CancellationToken cancellationToken)
-        {
-            var index = 0;
-            using (var e = source.GetEnumerator())
-            {
-                while (await e.MoveNext(cancellationToken)
-                              .ConfigureAwait(false))
-                {
-                    action(e.Current, checked(index++));
-                }
-            }
-        }
-    }
-}

+ 0 - 101
Ix.NET/Source/System.Interactive.Async/Generate.cs

@@ -1,101 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)
-        {
-            if (condition == null)
-            {
-                throw new ArgumentNullException(nameof(condition));
-            }
-
-            if (iterate == null)
-            {
-                throw new ArgumentNullException(nameof(iterate));
-            }
-
-            if (resultSelector == null)
-            {
-                throw new ArgumentNullException(nameof(resultSelector));
-            }
-
-            return new GenerateAsyncIterator<TState, TResult>(initialState, condition, iterate, resultSelector);
-        }
-
-        private sealed class GenerateAsyncIterator<TState, TResult> : AsyncIterator<TResult>
-        {
-            private readonly Func<TState, bool> condition;
-            private readonly TState initialState;
-            private readonly Func<TState, TState> iterate;
-            private readonly Func<TState, TResult> resultSelector;
-
-            private TState currentState;
-
-            private bool started;
-
-            public GenerateAsyncIterator(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)
-            {
-                Debug.Assert(condition != null);
-                Debug.Assert(iterate != null);
-                Debug.Assert(resultSelector != null);
-
-                this.initialState = initialState;
-                this.condition = condition;
-                this.iterate = iterate;
-                this.resultSelector = resultSelector;
-            }
-
-            public override AsyncIterator<TResult> Clone()
-            {
-                return new GenerateAsyncIterator<TState, TResult>(initialState, condition, iterate, resultSelector);
-            }
-
-            public override void Dispose()
-            {
-                currentState = default;
-
-                base.Dispose();
-            }
-
-            protected override Task<bool> MoveNextCore(CancellationToken cancellationToken)
-            {
-                switch (state)
-                {
-                    case AsyncIteratorState.Allocated:
-                        started = false;
-                        currentState = initialState;
-
-                        state = AsyncIteratorState.Iterating;
-                        goto case AsyncIteratorState.Iterating;
-
-                    case AsyncIteratorState.Iterating:
-                        if (started)
-                        {
-                            currentState = iterate(currentState);
-                        }
-
-                        started = true;
-
-                        if (condition(currentState))
-                        {
-                            current = resultSelector(currentState);
-                            return TaskExt.True;
-                        }
-                        break;
-                }
-
-                Dispose();
-                return TaskExt.False;
-            }
-        }
-    }
-}

+ 0 - 171
Ix.NET/Source/System.Interactive.Async/GroupJoin.cs

@@ -1,171 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// 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.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Linq
-{
-    public static partial class AsyncEnumerable
-    {
-        public static IAsyncEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IAsyncEnumerable<TOuter> outer, IAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IAsyncEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
-        {
-            if (outer == null)
-            {
-                throw new ArgumentNullException(nameof(outer));
-            }
-
-            if (inner == null)
-            {
-                throw new ArgumentNullException(nameof(inner));
-            }
-
-            if (outerKeySelector == null)
-            {
-                throw new ArgumentNullException(nameof(outerKeySelector));
-            }
-
-            if (innerKeySelector == null)
-            {
-                throw new ArgumentNullException(nameof(innerKeySelector));
-            }
-
-            if (resultSelector == null)
-            {
-                throw new ArgumentNullException(nameof(resultSelector));
-            }
-
-            if (comparer == null)
-            {
-                throw new ArgumentNullException(nameof(comparer));
-            }
-
-            return new GroupJoinAsyncEnumerable<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);
-        }
-
-        public static IAsyncEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IAsyncEnumerable<TOuter> outer, IAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IAsyncEnumerable<TInner>, TResult> resultSelector)
-        {
-            if (outer == null)
-            {
-                throw new ArgumentNullException(nameof(outer));
-            }
-
-            if (inner == null)
-            {
-                throw new ArgumentNullException(nameof(inner));
-            }
-
-            if (outerKeySelector == null)
-            {
-                throw new ArgumentNullException(nameof(outerKeySelector));
-            }
-
-            if (innerKeySelector == null)
-            {
-                throw new ArgumentNullException(nameof(innerKeySelector));
-            }
-
-            if (resultSelector == null)
-            {
-                throw new ArgumentNullException(nameof(resultSelector));
-            }
-
-            return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);
-        }
-
-
-
-
-        private sealed class GroupJoinAsyncEnumerable<TOuter, TInner, TKey, TResult> : IAsyncEnumerable<TResult>
-        {
-            private readonly IEqualityComparer<TKey> _comparer;
-            private readonly IAsyncEnumerable<TInner> _inner;
-            private readonly Func<TInner, TKey> _innerKeySelector;
-            private readonly IAsyncEnumerable<TOuter> _outer;
-            private readonly Func<TOuter, TKey> _outerKeySelector;
-            private readonly Func<TOuter, IAsyncEnumerable<TInner>, TResult> _resultSelector;
-
-            public GroupJoinAsyncEnumerable(
-                IAsyncEnumerable<TOuter> outer,
-                IAsyncEnumerable<TInner> inner,
-                Func<TOuter, TKey> outerKeySelector,
-                Func<TInner, TKey> innerKeySelector,
-                Func<TOuter, IAsyncEnumerable<TInner>, TResult> resultSelector,
-                IEqualityComparer<TKey> comparer)
-            {
-                _outer = outer;
-                _inner = inner;
-                _outerKeySelector = outerKeySelector;
-                _innerKeySelector = innerKeySelector;
-                _resultSelector = resultSelector;
-                _comparer = comparer;
-            }
-
-            public IAsyncEnumerator<TResult> GetEnumerator()
-                => new GroupJoinAsyncEnumerator(
-                    _outer.GetEnumerator(),
-                    _inner,
-                    _outerKeySelector,
-                    _innerKeySelector,
-                    _resultSelector,
-                    _comparer);
-
-            private sealed class GroupJoinAsyncEnumerator : IAsyncEnumerator<TResult>
-            {
-                private readonly IEqualityComparer<TKey> _comparer;
-                private readonly IAsyncEnumerable<TInner> _inner;
-                private readonly Func<TInner, TKey> _innerKeySelector;
-                private readonly IAsyncEnumerator<TOuter> _outer;
-                private readonly Func<TOuter, TKey> _outerKeySelector;
-                private readonly Func<TOuter, IAsyncEnumerable<TInner>, TResult> _resultSelector;
-
-                private Internal.Lookup<TKey, TInner> _lookup;
-
-                public GroupJoinAsyncEnumerator(
-                    IAsyncEnumerator<TOuter> outer,
-                    IAsyncEnumerable<TInner> inner,
-                    Func<TOuter, TKey> outerKeySelector,
-                    Func<TInner, TKey> innerKeySelector,
-                    Func<TOuter, IAsyncEnumerable<TInner>, TResult> resultSelector,
-                    IEqualityComparer<TKey> comparer)
-                {
-                    _outer = outer;
-                    _inner = inner;
-                    _outerKeySelector = outerKeySelector;
-                    _innerKeySelector = innerKeySelector;
-                    _resultSelector = resultSelector;
-                    _comparer = comparer;
-                }
-
-                public async Task<bool> MoveNext(CancellationToken cancellationToken)
-                {
-                    // nothing to do 
-                    if (!await _outer.MoveNext(cancellationToken)
-                                     .ConfigureAwait(false))
-                    {
-                        return false;
-                    }
-
-                    if (_lookup == null)
-                    {
-                        _lookup = await Internal.Lookup<TKey, TInner>.CreateForJoinAsync(_inner, _innerKeySelector, _comparer, cancellationToken)
-                                                .ConfigureAwait(false);
-                    }
-
-                    var item = _outer.Current;
-                    Current = _resultSelector(item, _lookup[_outerKeySelector(item)].ToAsyncEnumerable());
-                    return true;
-                }
-
-                public TResult Current { get; private set; }
-
-                public void Dispose()
-                {
-                    _outer.Dispose();
-                }
-            }
-        }
-    }
-}

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません