Bladeren bron

Merge branch 'master' into dev/bartde/switch_expr

Bart J.F. De Smet 6 jaren geleden
bovenliggende
commit
36d59e375d
87 gewijzigde bestanden met toevoegingen van 492 en 3440 verwijderingen
  1. 0 8
      .editorconfig
  2. 5 3
      Ix.NET/Source/AsyncQueryableGenerator.t4
  3. 3 1
      Ix.NET/Source/FasterLinq/Program.cs
  4. 0 2
      Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj
  5. 201 201
      Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.cs
  6. 4 4
      Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs
  7. 1 3
      Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj
  8. 0 10
      Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Distinct.cs
  9. 1 1
      Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Never.cs
  10. 0 3
      Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/OnErrorResumeNext.cs
  11. 1 4
      Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Timeout.cs
  12. 0 88
      Ix.NET/Source/System.Interactive.Tests/BufferTest.cs
  13. 0 89
      Ix.NET/Source/System.Interactive.Tests/CaseTest.cs
  14. 0 210
      Ix.NET/Source/System.Interactive.Tests/CatchTest.cs
  15. 0 63
      Ix.NET/Source/System.Interactive.Tests/ConcatTest.cs
  16. 0 119
      Ix.NET/Source/System.Interactive.Tests/CreateTest.cs
  17. 0 53
      Ix.NET/Source/System.Interactive.Tests/DeferTest.cs
  18. 0 52
      Ix.NET/Source/System.Interactive.Tests/DistinctTest.cs
  19. 0 42
      Ix.NET/Source/System.Interactive.Tests/DistinctUntilChangedTest.cs
  20. 0 103
      Ix.NET/Source/System.Interactive.Tests/DoTest.cs
  21. 0 38
      Ix.NET/Source/System.Interactive.Tests/DoWhileTest.cs
  22. 0 43
      Ix.NET/Source/System.Interactive.Tests/ExpandTest.cs
  23. 0 86
      Ix.NET/Source/System.Interactive.Tests/FinallyTest.cs
  24. 0 40
      Ix.NET/Source/System.Interactive.Tests/ForEachTest.cs
  25. 0 27
      Ix.NET/Source/System.Interactive.Tests/ForTest.cs
  26. 0 30
      Ix.NET/Source/System.Interactive.Tests/GenerateTest.cs
  27. 0 30
      Ix.NET/Source/System.Interactive.Tests/HideTest.cs
  28. 0 49
      Ix.NET/Source/System.Interactive.Tests/IfTest.cs
  29. 0 29
      Ix.NET/Source/System.Interactive.Tests/IgnoreElementsTest.cs
  30. 0 33
      Ix.NET/Source/System.Interactive.Tests/IsEmptyTest.cs
  31. 0 36
      Ix.NET/Source/System.Interactive.Tests/MaxByTest.cs
  32. 0 36
      Ix.NET/Source/System.Interactive.Tests/MaxTest.cs
  33. 0 273
      Ix.NET/Source/System.Interactive.Tests/MemoizeTest.cs
  34. 0 38
      Ix.NET/Source/System.Interactive.Tests/MinByTest.cs
  35. 0 36
      Ix.NET/Source/System.Interactive.Tests/MinTest.cs
  36. 0 23
      Ix.NET/Source/System.Interactive.Tests/NopObserver.cs
  37. 0 86
      Ix.NET/Source/System.Interactive.Tests/OnErrorResumeNextTest.cs
  38. 0 284
      Ix.NET/Source/System.Interactive.Tests/PublishTest.cs
  39. 0 163
      Ix.NET/Source/System.Interactive.Tests/QueryableParityTest.cs
  40. 0 55
      Ix.NET/Source/System.Interactive.Tests/RepeatTest.cs
  41. 0 55
      Ix.NET/Source/System.Interactive.Tests/RetryTest.cs
  42. 0 21
      Ix.NET/Source/System.Interactive.Tests/ReturnTest.cs
  43. 0 36
      Ix.NET/Source/System.Interactive.Tests/ScanTest.cs
  44. 0 27
      Ix.NET/Source/System.Interactive.Tests/SelectManyTest.cs
  45. 0 125
      Ix.NET/Source/System.Interactive.Tests/ShareTest.cs
  46. 0 58
      Ix.NET/Source/System.Interactive.Tests/SkipLastTest.cs
  47. 0 38
      Ix.NET/Source/System.Interactive.Tests/StartWithTest.cs
  48. 1 3
      Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj
  49. 6 6
      Ix.NET/Source/System.Interactive.Tests/System/Linq/Operators/Using.cs
  50. 0 73
      Ix.NET/Source/System.Interactive.Tests/TakeLastTest.cs
  51. 0 31
      Ix.NET/Source/System.Interactive.Tests/ThrowTest.cs
  52. 0 75
      Ix.NET/Source/System.Interactive.Tests/UsingTest.cs
  53. 0 38
      Ix.NET/Source/System.Interactive.Tests/WhileTest.cs
  54. 2 2
      Ix.NET/Source/System.Interactive/System/Linq/Operators/Catch.cs
  55. 1 1
      Ix.NET/Source/System.Interactive/System/Linq/Operators/Memoize.cs
  56. 6 4
      Ix.NET/Source/System.Interactive/System/Linq/Operators/Publish.cs
  57. 2 2
      Ix.NET/Source/System.Interactive/System/Linq/Yielder.cs
  58. 0 1
      Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj
  59. 1 1
      Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableQuery.cs
  60. 5 5
      Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableRewriter.cs
  61. 197 197
      Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncQueryable.Generated.cs
  62. 2 2
      Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncQueryable.cs
  63. 1 4
      Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj
  64. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupBy.cs
  65. 4 4
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Join.cs
  66. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs
  67. 5 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToLookup.cs
  68. 4 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToObservable.cs
  69. 16 16
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.cs
  70. 4 2
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.tt
  71. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerablePartition.cs
  72. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerator.cs
  73. 1 1
      Ix.NET/Source/System.Linq.Async/System/Linq/AsyncListPartition.cs
  74. 1 1
      Ix.NET/Source/System.Linq.Async/System/Linq/Maybe.cs
  75. 0 2
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/AppendPrepend.cs
  76. 0 5
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Concat.cs
  77. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/DefaultIfEmpty.cs
  78. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Distinct.cs
  79. 0 22
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Lookup.cs
  80. 0 3
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Reverse.cs
  81. 0 19
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs
  82. 0 10
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs
  83. 1 1
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToAsyncEnumerable.Observable.cs
  84. 0 7
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToAsyncEnumerable.cs
  85. 12 12
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToDictionary.cs
  86. 1 3
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Union.cs
  87. 0 14
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs

+ 0 - 8
.editorconfig

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

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

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

+ 3 - 1
Ix.NET/Source/FasterLinq/Program.cs

@@ -1,7 +1,9 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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. 
 
+#nullable disable
+
 using System;
 using System.Collections;
 using System.Collections.Generic;

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

@@ -5,7 +5,6 @@
     <NoWarn>$(NoWarn);CS0618</NoWarn>
   </PropertyGroup>
 
-
   <ItemGroup>
     <Content Include="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -24,7 +23,6 @@
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
     <PackageReference Include="FluentAssertions" Version="5.9.0" />
-
     <PackageReference Include="xunit" Version="2.4.1" />
   </ItemGroup>
 

File diff suppressed because it is too large
+ 201 - 201
Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.cs


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

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

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

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

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

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

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

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

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

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

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

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

+ 0 - 88
Ix.NET/Source/System.Interactive.Tests/BufferTest.cs

@@ -1,88 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class BufferTest : Tests
-    {
-        [Fact]
-        public void Buffer_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Buffer<int>(null, 5));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Buffer<int>(null, 5, 3));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Buffer<int>(new[] { 1 }, 0));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Buffer<int>(new[] { 1 }, 5, 0));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Buffer<int>(new[] { 1 }, 0, 3));
-        }
-
-        [Fact]
-        public void Buffer1()
-        {
-            var rng = Enumerable.Range(0, 10);
-
-            var res = rng.Buffer(3).ToList();
-            Assert.Equal(4, res.Count);
-
-            Assert.True(res[0].SequenceEqual(new[] { 0, 1, 2 }));
-            Assert.True(res[1].SequenceEqual(new[] { 3, 4, 5 }));
-            Assert.True(res[2].SequenceEqual(new[] { 6, 7, 8 }));
-            Assert.True(res[3].SequenceEqual(new[] { 9 }));
-        }
-
-        [Fact]
-        public void Buffer2()
-        {
-            var rng = Enumerable.Range(0, 10);
-
-            var res = rng.Buffer(5).ToList();
-            Assert.Equal(2, res.Count);
-
-            Assert.True(res[0].SequenceEqual(new[] { 0, 1, 2, 3, 4 }));
-            Assert.True(res[1].SequenceEqual(new[] { 5, 6, 7, 8, 9 }));
-        }
-
-        [Fact]
-        public void Buffer3()
-        {
-            var rng = Enumerable.Empty<int>();
-
-            var res = rng.Buffer(5).ToList();
-            Assert.Empty(res);
-        }
-
-        [Fact]
-        public void Buffer4()
-        {
-            var rng = Enumerable.Range(0, 10);
-
-            var res = rng.Buffer(3, 2).ToList();
-            Assert.Equal(5, res.Count);
-
-            Assert.True(res[0].SequenceEqual(new[] { 0, 1, 2 }));
-            Assert.True(res[1].SequenceEqual(new[] { 2, 3, 4 }));
-            Assert.True(res[2].SequenceEqual(new[] { 4, 5, 6 }));
-            Assert.True(res[3].SequenceEqual(new[] { 6, 7, 8 }));
-            Assert.True(res[4].SequenceEqual(new[] { 8, 9 }));
-        }
-
-        [Fact]
-        public void Buffer5()
-        {
-            var rng = Enumerable.Range(0, 10);
-
-            var res = rng.Buffer(3, 4).ToList();
-            Assert.Equal(3, res.Count);
-
-            Assert.True(res[0].SequenceEqual(new[] { 0, 1, 2 }));
-            Assert.True(res[1].SequenceEqual(new[] { 4, 5, 6 }));
-            Assert.True(res[2].SequenceEqual(new[] { 8, 9 }));
-        }
-    }
-}

+ 0 - 89
Ix.NET/Source/System.Interactive.Tests/CaseTest.cs

@@ -1,89 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class CaseTest : Tests
-    {
-        [Fact]
-        public void Case_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Case<int, int>(null, new Dictionary<int, IEnumerable<int>>()));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Case<int, int>(() => 1, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Case<int, int>(null, new Dictionary<int, IEnumerable<int>>(), new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Case<int, int>(() => 1, null, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Case<int, int>(() => 1, new Dictionary<int, IEnumerable<int>>(), null));
-        }
-
-        [Fact]
-        public void Case1()
-        {
-            var x = 1;
-            var d = 'd';
-            var res = EnumerableEx.Case<int, char>(() => x, new Dictionary<int, IEnumerable<char>>
-            {
-                { 0, new[] { 'a' } },
-                { 1, new[] { 'b' } },
-                { 2, new[] { 'c' } },
-                { 3, EnumerableEx.Defer(() => new[] { d }) },
-            });
-
-            Assert.Equal('b', res.Single());
-            Assert.Equal('b', res.Single());
-
-            x = 0;
-            Assert.Equal('a', res.Single());
-
-            x = 2;
-            Assert.Equal('c', res.Single());
-
-            x = 3;
-            Assert.Equal('d', res.Single());
-
-            d = 'e';
-            Assert.Equal('e', res.Single());
-
-            x = 4;
-            Assert.True(res.IsEmpty());
-        }
-
-        [Fact]
-        public void Case2()
-        {
-            var x = 1;
-            var d = 'd';
-            var res = EnumerableEx.Case<int, char>(() => x, new Dictionary<int, IEnumerable<char>>
-            {
-                { 0, new[] { 'a' } },
-                { 1, new[] { 'b' } },
-                { 2, new[] { 'c' } },
-                { 3, EnumerableEx.Defer(() => new[] { d }) },
-            }, new[] { 'z' });
-
-            Assert.Equal('b', res.Single());
-            Assert.Equal('b', res.Single());
-
-            x = 0;
-            Assert.Equal('a', res.Single());
-
-            x = 2;
-            Assert.Equal('c', res.Single());
-
-            x = 3;
-            Assert.Equal('d', res.Single());
-
-            d = 'e';
-            Assert.Equal('e', res.Single());
-
-            x = 4;
-            Assert.Equal('z', res.Single());
-        }
-    }
-}

+ 0 - 210
Ix.NET/Source/System.Interactive.Tests/CatchTest.cs

@@ -1,210 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class CatchTest : Tests
-    {
-        [Fact]
-        public void Catch_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Catch<int>(null, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Catch<int>(new[] { 1 }, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Catch<int>(default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Catch<int>(default(IEnumerable<IEnumerable<int>>)));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Catch<int, Exception>(null, ex => new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Catch<int, Exception>(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void Catch1()
-        {
-            var ex = new MyException();
-            var res = EnumerableEx.Throw<int>(ex).Catch<int, MyException>(e => { Assert.Same(ex, e); return new[] { 42 }; }).Single();
-            Assert.Equal(42, res);
-        }
-
-        [Fact]
-        public void Catch2()
-        {
-            var ex = new MyException();
-            var res = EnumerableEx.Throw<int>(ex).Catch<int, Exception>(e => { Assert.Same(ex, e); return new[] { 42 }; }).Single();
-            Assert.Equal(42, res);
-        }
-
-        [Fact]
-        public void Catch3()
-        {
-            var ex = new MyException();
-            AssertThrows<MyException>(() =>
-            {
-                EnumerableEx.Throw<int>(ex).Catch<int, InvalidOperationException>(e => { Assert.True(false); return new[] { 42 }; }).Single();
-            });
-        }
-
-        [Fact]
-        public void Catch4()
-        {
-            var xs = Enumerable.Range(0, 10);
-            var res = xs.Catch<int, MyException>(e => { Assert.True(false); return new[] { 42 }; });
-            Assert.True(xs.SequenceEqual(res));
-        }
-
-        [Fact]
-        public void Catch5()
-        {
-            var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) };
-            var res = EnumerableEx.Catch(xss);
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 5)));
-        }
-
-        [Fact]
-        public void Catch6()
-        {
-            var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) };
-            var res = xss.Catch();
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 5)));
-        }
-
-        [Fact]
-        public void Catch7()
-        {
-            var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) };
-            var res = xss[0].Catch(xss[1]);
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 5)));
-        }
-
-        [Fact]
-        public void Catch8()
-        {
-            var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw<int>(new MyException())), Enumerable.Range(5, 5) };
-            var res = EnumerableEx.Catch(xss);
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 10)));
-        }
-
-        [Fact]
-        public void Catch9()
-        {
-            var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw<int>(new MyException())), Enumerable.Range(5, 5) };
-            var res = xss.Catch();
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 10)));
-        }
-
-        [Fact]
-        public void Catch10()
-        {
-            var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw<int>(new MyException())), Enumerable.Range(5, 5) };
-            var res = xss[0].Catch(xss[1]);
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 10)));
-        }
-
-        [Fact]
-        public void Catch11()
-        {
-            var e1 = new MyException();
-            var ex1 = EnumerableEx.Throw<int>(e1);
-
-            var e2 = new MyException();
-            var ex2 = EnumerableEx.Throw<int>(e2);
-
-            var e3 = new MyException();
-            var ex3 = EnumerableEx.Throw<int>(e3);
-
-            var xss = new[] { Enumerable.Range(0, 2).Concat(ex1), Enumerable.Range(2, 2).Concat(ex2), ex3 };
-            var res = xss.Catch();
-
-            var e = res.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            AssertThrows<MyException>(() => e.MoveNext(), ex => ex == e3);
-        }
-
-        [Fact]
-        public void Catch4_Array()
-        {
-            var xs = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-            var res = xs.Catch<int, MyException>(e => { Assert.False(true); return new[] { 42 }; });
-            Assert.True(xs.SequenceEqual(res));
-        }
-
-        [Fact]
-        public void Catch5_Array()
-        {
-            var xss = new[] { new[] { 0, 1, 2, 3, 4 }, new[] { 5, 6, 7, 8, 9 } };
-            var res = EnumerableEx.Catch(xss);
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 5)));
-        }
-
-        [Fact]
-        public void Catch6_Array()
-        {
-            var xss = new[] { new[] { 0, 1, 2, 3, 4 }, new[] { 5, 6, 7, 8, 9 } };
-            var res = xss.Catch();
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 5)));
-        }
-
-        [Fact]
-        public void Catch7_Array()
-        {
-            var xss = new[] { new[] { 0, 1, 2, 3, 4 }, new[] { 5, 6, 7, 8, 9 } };
-            var res = xss[0].Catch(xss[1]);
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 5)));
-        }
-
-        [Fact]
-        public void Catch8_Array()
-        {
-            var xss = new[] { new[] { 0, 1, 2, 3, 4 }.Concat(EnumerableEx.Throw<int>(new MyException())), new[] { 5, 6, 7, 8, 9 } };
-            var res = EnumerableEx.Catch(xss);
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 10)));
-        }
-
-        [Fact]
-        public void Catch9_Array()
-        {
-            var xss = new[] { new[] { 0, 1, 2, 3, 4 }.Concat(EnumerableEx.Throw<int>(new MyException())), new[] { 5, 6, 7, 8, 9 } };
-            var res = xss.Catch();
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 10)));
-        }
-
-        [Fact]
-        public void Catch10_Array()
-        {
-            var xss = new[] { new[] { 0, 1, 2, 3, 4 }.Concat(EnumerableEx.Throw<int>(new MyException())), new[] { 5, 6, 7, 8, 9 } };
-            var res = xss[0].Catch(xss[1]);
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 10)));
-        }
-
-        [Fact]
-        public void Catch11_Array()
-        {
-            var e1 = new MyException();
-            var ex1 = EnumerableEx.Throw<int>(e1);
-
-            var e2 = new MyException();
-            var ex2 = EnumerableEx.Throw<int>(e2);
-
-            var e3 = new MyException();
-            var ex3 = EnumerableEx.Throw<int>(e3);
-
-            var xss = new[] { new[] { 0, 1 }.Concat(ex1), new[] { 2, 3 }.Concat(ex2), ex3 };
-            var res = xss.Catch();
-
-            var e = res.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            AssertThrows<MyException>(() => e.MoveNext(), ex => ex == e3);
-        }
-    }
-}

+ 0 - 63
Ix.NET/Source/System.Interactive.Tests/ConcatTest.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;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class ConcatTest : Tests
-    {
-        [Fact]
-        public void Concat_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Concat(default(IEnumerable<int>[])));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Concat(default(IEnumerable<IEnumerable<int>>)));
-        }
-
-        [Fact]
-        public void Concat1()
-        {
-            var res = new[]
-            {
-                new[] { 1, 2, 3 },
-                new[] { 4, 5 }
-            }.Concat();
-
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5 }));
-        }
-
-        [Fact]
-        public void Concat2()
-        {
-            var i = 0;
-            var xss = Enumerable.Range(0, 3).Select(x => Enumerable.Range(0, x + 1)).Do(_ => ++i);
-
-            var res = xss.Concat().Select(x => i + " - " + x).ToList();
-
-            Assert.True(Enumerable.SequenceEqual(res, new[] {
-                "1 - 0",
-                "2 - 0",
-                "2 - 1",
-                "3 - 0",
-                "3 - 1",
-                "3 - 2",
-            }));
-        }
-
-        [Fact]
-        public void Concat3()
-        {
-            var res = EnumerableEx.Concat(
-                new[] { 1, 2, 3 },
-                new[] { 4, 5 }
-            );
-
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5 }));
-        }
-    }
-}

+ 0 - 119
Ix.NET/Source/System.Interactive.Tests/CreateTest.cs

@@ -1,119 +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.Text;
-using System.Linq;
-using Xunit;
-using System.Collections;
-using System.Threading;
-
-namespace Tests
-{
-    public class CreateTest : Tests
-    {
-        [Fact]
-        public void Create_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Create<int>(default));
-        }
-
-        [Fact]
-        public void Create1()
-        {
-            var hot = false;
-            var res = EnumerableEx.Create<int>(() =>
-            {
-                hot = true;
-                return MyEnumerator();
-            });
-
-            Assert.False(hot);
-
-            var e = res.GetEnumerator();
-            Assert.True(hot);
-
-            HasNext(e, 1);
-            HasNext(e, 2);
-            NoNext(e);
-
-            hot = false;
-            var f = ((IEnumerable)res).GetEnumerator();
-            Assert.True(hot);
-        }
-
-        [Fact]
-        public void CreateYield()
-        {
-            SynchronizationContext.SetSynchronizationContext(null);
-
-            var xs = EnumerableEx.Create<int>(async yield =>
-            {
-                var i = 0;
-                while (i < 10)
-                {
-                    await yield.Return(i++);
-                }
-            });
-
-            var j = 0;
-            foreach (var elem in xs)
-            {
-                Assert.Equal(j, elem);
-                j++;
-            }
-
-            Assert.Equal(10, j);
-        }
-
-        [Fact]
-        public void CreateYieldBreak()
-        {
-            SynchronizationContext.SetSynchronizationContext(null);
-
-            var xs = EnumerableEx.Create<int>(async yield =>
-            {
-                var i = 0;
-                while (true)
-                {
-                    if (i == 10)
-                    {
-                        await yield.Break();
-                        return;
-                    }
-
-                    await yield.Return(i++);
-                }
-            });
-
-            var j = 0;
-            foreach (var elem in xs)
-            {
-                Assert.Equal(elem, j);
-                j++;
-            }
-
-            Assert.Equal(10, j);
-        }
-
-        [Fact]
-        public void YielderNoReset()
-        {
-            var xs = EnumerableEx.Create<int>(async yield =>
-            {
-                await yield.Break();
-            });
-
-            AssertThrows<NotSupportedException>(() => xs.GetEnumerator().Reset());
-        }
-
-
-        private static IEnumerator<int> MyEnumerator()
-        {
-            yield return 1;
-            yield return 2;
-        }
-    }
-}

+ 0 - 53
Ix.NET/Source/System.Interactive.Tests/DeferTest.cs

@@ -1,53 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class DeferTest : Tests
-    {
-        [Fact]
-        public void Defer_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Defer<int>(null));
-        }
-
-        [Fact]
-        public void Defer1()
-        {
-            var i = 0;
-            var n = 5;
-            var xs = EnumerableEx.Defer(() =>
-            {
-                i++;
-                return Enumerable.Range(0, n);
-            });
-
-            Assert.Equal(0, i);
-
-            Assert.True(Enumerable.SequenceEqual(xs, Enumerable.Range(0, n)));
-            Assert.Equal(1, i);
-
-            n = 3;
-            Assert.True(Enumerable.SequenceEqual(xs, Enumerable.Range(0, n)));
-            Assert.Equal(2, i);
-        }
-
-        [Fact]
-        public void Defer2()
-        {
-            var xs = EnumerableEx.Defer<int>(() =>
-            {
-                throw new MyException();
-            });
-
-            AssertThrows<MyException>(() => xs.GetEnumerator().MoveNext());
-        }
-    }
-}

+ 0 - 52
Ix.NET/Source/System.Interactive.Tests/DistinctTest.cs

@@ -1,52 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class DistinctTest : Tests
-    {
-        [Fact]
-        public void Distinct_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Distinct<int, int>(null, _ => _));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Distinct<int, int>(new[] { 1 }, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Distinct<int, int>(null, _ => _, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Distinct<int, int>(new[] { 1 }, null, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Distinct<int, int>(new[] { 1 }, _ => _, null));
-        }
-
-        [Fact]
-        public void Distinct1()
-        {
-            var res = Enumerable.Range(0, 10).Distinct(x => x % 5).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, Enumerable.Range(0, 5)));
-        }
-
-        [Fact]
-        public void Distinct2()
-        {
-            var res = Enumerable.Range(0, 10).Distinct(x => x % 5, new MyEqualityComparer()).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 0, 1 }));
-        }
-
-        private class MyEqualityComparer : IEqualityComparer<int>
-        {
-            public bool Equals(int x, int y)
-            {
-                return x % 2 == y % 2;
-            }
-
-            public int GetHashCode(int obj)
-            {
-                return EqualityComparer<int>.Default.GetHashCode(obj % 2);
-            }
-        }
-    }
-}

+ 0 - 42
Ix.NET/Source/System.Interactive.Tests/DistinctUntilChangedTest.cs

@@ -1,42 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class DistinctUntilChangedTest : Tests
-    {
-        [Fact]
-        public void DistinctUntilChanged_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DistinctUntilChanged<int>(null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DistinctUntilChanged<int>(null, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DistinctUntilChanged<int>(new[] { 1 }, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DistinctUntilChanged<int, int>(null, _ => _));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DistinctUntilChanged<int, int>(new[] { 1 }, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DistinctUntilChanged<int, int>(null, _ => _, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DistinctUntilChanged<int, int>(new[] { 1 }, null, EqualityComparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DistinctUntilChanged<int, int>(new[] { 1 }, _ => _, null));
-        }
-
-        [Fact]
-        public void DistinctUntilChanged1()
-        {
-            var res = new[] { 1, 2, 2, 3, 3, 3, 2, 2, 1 }.DistinctUntilChanged().ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 2, 1 }));
-        }
-
-        [Fact]
-        public void DistinctUntilChanged2()
-        {
-            var res = new[] { 1, 1, 2, 3, 4, 5, 5, 6, 7 }.DistinctUntilChanged(x => x / 2).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 4, 6 }));
-        }
-    }
-}

+ 0 - 103
Ix.NET/Source/System.Interactive.Tests/DoTest.cs

@@ -1,103 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class DoTest : Tests
-    {
-        [Fact]
-        public void Do_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(null, _ => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(null, _ => { }, () => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(null, _ => { }, _ => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(null, _ => { }, _ => { }, () => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, default(Action<int>)));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, default, () => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, _ => { }, default(Action)));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, default, _ => { }, () => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, _ => { }, default, () => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, _ => { }, _ => { }, default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, default, _ => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, _ => { }, default(Action<Exception>)));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(null, new MyObserver()));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Do<int>(new[] { 1 }, default(IObserver<int>)));
-        }
-
-        [Fact]
-        public void Do1()
-        {
-            var n = 0;
-            Enumerable.Range(0, 10).Do(x => n += x).ForEach(_ => { });
-            Assert.Equal(45, n);
-        }
-
-        [Fact]
-        public void Do2()
-        {
-            var n = 0;
-            Enumerable.Range(0, 10).Do(x => n += x, () => n *= 2).ForEach(_ => { });
-            Assert.Equal(90, n);
-        }
-
-        [Fact]
-        public void Do3()
-        {
-            var ex = new MyException();
-            var ok = false;
-            AssertThrows<MyException>(() =>
-                EnumerableEx.Throw<int>(ex).Do(x => { Assert.True(false); }, e => { Assert.Equal(ex, e); ok = true; }).ForEach(_ => { })
-            );
-            Assert.True(ok);
-        }
-
-        [Fact]
-        public void Do4()
-        {
-            var obs = new MyObserver();
-            Enumerable.Range(0, 10).Do(obs).ForEach(_ => { });
-
-            Assert.True(obs.Done);
-            Assert.Equal(45, obs.Sum);
-        }
-
-        private class MyObserver : IObserver<int>
-        {
-            public int Sum;
-            public bool Done;
-
-            public void OnCompleted()
-            {
-                Done = true;
-            }
-
-            public void OnError(Exception error)
-            {
-                throw new NotImplementedException();
-            }
-
-            public void OnNext(int value)
-            {
-                Sum += value;
-            }
-        }
-
-        [Fact]
-        public void Do5()
-        {
-            var sum = 0;
-            var done = false;
-            Enumerable.Range(0, 10).Do(x => sum += x, ex => { throw ex; }, () => done = true).ForEach(_ => { });
-
-            Assert.True(done);
-            Assert.Equal(45, sum);
-        }
-    }
-}

+ 0 - 38
Ix.NET/Source/System.Interactive.Tests/DoWhileTest.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;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class DoWhileTest : Tests
-    {
-        [Fact]
-        public void DoWhile_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DoWhile<int>(new[] { 1 }, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.DoWhile<int>(null, () => true));
-        }
-
-        [Fact]
-        public void DoWhile1()
-        {
-            var x = 5;
-            var res = EnumerableEx.DoWhile(EnumerableEx.Defer(() => new[] { x }).Do(_ => x--), () => x > 0).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 5, 4, 3, 2, 1 }));
-        }
-
-        [Fact]
-        public void DoWhile2()
-        {
-            var x = 0;
-            var res = EnumerableEx.DoWhile(EnumerableEx.Defer(() => new[] { x }).Do(_ => x--), () => x > 0).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 0 }));
-        }
-    }
-}

+ 0 - 43
Ix.NET/Source/System.Interactive.Tests/ExpandTest.cs

@@ -1,43 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class ExpandTest : Tests
-    {
-        [Fact]
-        public void Expand_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Expand<int>(null, _ => new[] { _ }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Expand<int>(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void Expand1()
-        {
-            var res = new[] { 0 }.Expand(x => new[] { x + 1 }).Take(10).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, Enumerable.Range(0, 10)));
-        }
-
-        [Fact]
-        public void Expand2()
-        {
-            var res = new[] { 3 }.Expand(x => Enumerable.Range(0, x)).ToList();
-            var exp = new[] {
-                3,
-                0, 1, 2,
-                0,
-                0, 1,
-                0
-            };
-            Assert.True(Enumerable.SequenceEqual(res, exp));
-        }
-    }
-}

+ 0 - 86
Ix.NET/Source/System.Interactive.Tests/FinallyTest.cs

@@ -1,86 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class FinallyTest : Tests
-    {
-        [Fact]
-        public void Finally_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Finally<int>(null, () => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Finally<int>(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void Finally1()
-        {
-            var done = false;
-
-            var xs = Enumerable.Range(0, 2).Finally(() => done = true);
-            Assert.False(done);
-
-            var e = xs.GetEnumerator();
-            Assert.False(done);
-
-            HasNext(e, 0);
-            Assert.False(done);
-
-            HasNext(e, 1);
-            Assert.False(done);
-
-            NoNext(e);
-            Assert.True(done);
-        }
-
-        [Fact]
-        public void Finally2()
-        {
-            var done = false;
-
-            var xs = Enumerable.Range(0, 2).Finally(() => done = true);
-            Assert.False(done);
-
-            var e = xs.GetEnumerator();
-            Assert.False(done);
-
-            HasNext(e, 0);
-            Assert.False(done);
-
-            e.Dispose();
-            Assert.True(done);
-        }
-
-        [Fact]
-        public void Finally3()
-        {
-            var done = false;
-
-            var ex = new MyException();
-            var xs = EnumerableEx.Throw<int>(ex).Finally(() => done = true);
-            Assert.False(done);
-
-            var e = xs.GetEnumerator();
-            Assert.False(done);
-
-            try
-            {
-                HasNext(e, 0);
-                Assert.True(false);
-            }
-            catch (MyException ex_)
-            {
-                Assert.Same(ex, ex_);
-            }
-
-            Assert.True(done);
-        }
-    }
-}

+ 0 - 40
Ix.NET/Source/System.Interactive.Tests/ForEachTest.cs

@@ -1,40 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class ForEachTest : Tests
-    {
-        [Fact]
-        public void ForEach_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.ForEach<int>(null, x => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.ForEach<int>(new[] { 1 }, default(Action<int>)));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.ForEach<int>(null, (x, i) => { }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.ForEach<int>(new[] { 1 }, default(Action<int, int>)));
-        }
-
-        [Fact]
-        public void ForEach1()
-        {
-            var n = 0;
-            Enumerable.Range(5, 3).ForEach(x => n += x);
-            Assert.Equal(5 + 6 + 7, n);
-        }
-
-        [Fact]
-        public void ForEach2()
-        {
-            var n = 0;
-            Enumerable.Range(5, 3).ForEach((x, i) => n += x * i);
-            Assert.Equal(5 * 0 + 6 * 1 + 7 * 2, n);
-        }
-    }
-}

+ 0 - 27
Ix.NET/Source/System.Interactive.Tests/ForTest.cs

@@ -1,27 +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 Xunit;
-
-namespace Tests
-{
-    public class ForTest : Tests
-    {
-        [Fact]
-        public void For_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.For<int, int>(null, x => new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.For<int, int>(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void For()
-        {
-            var res = EnumerableEx.For(new[] { 1, 2, 3 }, x => Enumerable.Range(0, x)).ToList();
-            Assert.True(res.SequenceEqual(new[] { 0, 0, 1, 0, 1, 2 }));
-        }
-    }
-}

+ 0 - 30
Ix.NET/Source/System.Interactive.Tests/GenerateTest.cs

@@ -1,30 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class GenerateTest : Tests
-    {
-        [Fact]
-        public void Generate_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Generate<int, int>(0, null, _ => _, _ => _));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Generate<int, int>(0, _ => true, null, _ => _));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Generate<int, int>(0, _ => true, _ => _, null));
-        }
-
-        [Fact]
-        public void Generate()
-        {
-            var res = EnumerableEx.Generate(0, x => x < 5, x => x + 1, x => x * x).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 0, 1, 4, 9, 16 }));
-        }
-    }
-}

+ 0 - 30
Ix.NET/Source/System.Interactive.Tests/HideTest.cs

@@ -1,30 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class HideTest : Tests
-    {
-        [Fact]
-        public void Hide_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Hide<int>(null));
-        }
-
-        [Fact]
-        public void Hide()
-        {
-            var xs = new List<int> { 1, 2, 3 };
-            var ys = xs.Hide();
-            Assert.False(ys is List<int>);
-            Assert.True(xs.SequenceEqual(ys));
-        }
-    }
-}

+ 0 - 49
Ix.NET/Source/System.Interactive.Tests/IfTest.cs

@@ -1,49 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class IfTest : Tests
-    {
-        [Fact]
-        public void If_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.If<int>(null, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.If<int>(() => true, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.If<int>(null, new[] { 1 }, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.If<int>(() => true, null, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.If<int>(() => true, new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void If1()
-        {
-            var x = 5;
-            var res = EnumerableEx.If(() => x > 0, new[] { +1 }, new[] { -1 });
-
-            Assert.Equal(+1, res.Single());
-
-            x = -x;
-            Assert.Equal(-1, res.Single());
-        }
-
-        [Fact]
-        public void If2()
-        {
-            var x = 5;
-            var res = EnumerableEx.If(() => x > 0, new[] { +1 });
-
-            Assert.Equal(+1, res.Single());
-
-            x = -x;
-            Assert.True(res.IsEmpty());
-        }
-    }
-}

+ 0 - 29
Ix.NET/Source/System.Interactive.Tests/IgnoreElementsTest.cs

@@ -1,29 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class IgnoreElementsTest : Tests
-    {
-        [Fact]
-        public void IgnoreElements_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.IgnoreElements<int>(null));
-        }
-
-        [Fact]
-        public void IgnoreElements()
-        {
-            var n = 0;
-            Enumerable.Range(0, 10).Do(_ => n++).IgnoreElements().Take(5).ForEach(_ => { });
-            Assert.Equal(10, n);
-        }
-    }
-}

+ 0 - 33
Ix.NET/Source/System.Interactive.Tests/IsEmptyTest.cs

@@ -1,33 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class IsEmptyTest : Tests
-    {
-        [Fact]
-        public void IsEmtpy_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.IsEmpty<int>(null));
-        }
-
-        [Fact]
-        public void IsEmpty_Empty()
-        {
-            Assert.True(Enumerable.Empty<int>().IsEmpty());
-        }
-
-        [Fact]
-        public void IsEmpty_NonEmpty()
-        {
-            Assert.False(new[] { 1 }.IsEmpty());
-        }
-    }
-}

+ 0 - 36
Ix.NET/Source/System.Interactive.Tests/MaxByTest.cs

@@ -1,36 +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 Xunit;
-
-namespace Tests
-{
-    public class MaxByTest : Tests
-    {
-        [Fact]
-        public void MaxBy_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MaxBy(null, (int x) => x));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MaxBy(new[] { 1 }, default(Func<int, int>)));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MaxBy(null, (int x) => x, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MaxBy(new[] { 1 }, default, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MaxBy(new[] { 1 }, (int x) => x, null));
-        }
-
-        [Fact]
-        public void MaxBy()
-        {
-            var res = new[] { 2, 5, 0, 7, 4, 3, 6, 2, 1 }.MaxBy(x => x % 3);
-            Assert.True(res.SequenceEqual(new[] { 2, 5, 2 }));
-        }
-
-        [Fact]
-        public void MaxBy_Empty()
-        {
-            AssertThrows<InvalidOperationException>(() => Enumerable.Empty<int>().MaxBy(x => x));
-        }
-    }
-}

+ 0 - 36
Ix.NET/Source/System.Interactive.Tests/MaxTest.cs

@@ -1,36 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class MaxTest : Tests
-    {
-        [Fact]
-        public void Max_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Max(null, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Max(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void Max()
-        {
-            Assert.Equal(5, new[] { 2, 5, 3, 7 }.Max(new Mod7Comparer()));
-        }
-
-        private class Mod7Comparer : IComparer<int>
-        {
-            public int Compare(int x, int y)
-            {
-                return Comparer<int>.Default.Compare(x % 7, y % 7);
-            }
-        }
-    }
-}

+ 0 - 273
Ix.NET/Source/System.Interactive.Tests/MemoizeTest.cs

@@ -1,273 +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.Text;
-using System.Linq;
-using Xunit;
-using System.Collections;
-
-namespace Tests
-{
-    public class MemoizeTest : Tests
-    {
-        [Fact]
-        public void Memoize_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Memoize<int>(null));
-        }
-
-        [Fact]
-        public void MemoizeLimited_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Memoize<int>(null, 2));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Memoize<int>(new[] { 1 }, 0));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Memoize<int>(new[] { 1 }, -1));
-        }
-
-        [Fact]
-        public void Memoize0()
-        {
-            var n = 0;
-            var rng = Tick(i => n += i).Memoize();
-
-            var e1 = rng.GetEnumerator();
-            var e2 = rng.GetEnumerator();
-
-            HasNext(e1, 0);
-            Assert.Equal(0, n);
-
-            HasNext(e1, 1);
-            Assert.Equal(1, n);
-
-            HasNext(e1, 2);
-            Assert.Equal(3, n);
-            HasNext(e2, 0);
-            Assert.Equal(3, n);
-
-            HasNext(e1, 3);
-            Assert.Equal(6, n);
-            HasNext(e2, 1);
-            Assert.Equal(6, n);
-
-            HasNext(e2, 2);
-            Assert.Equal(6, n);
-            HasNext(e2, 3);
-            Assert.Equal(6, n);
-
-            HasNext(e2, 4);
-            Assert.Equal(10, n);
-            HasNext(e1, 4);
-            Assert.Equal(10, n);
-        }
-
-        [Fact]
-        public void Memoize1()
-        {
-            var rng = Enumerable.Range(0, 5).Memoize();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            HasNext(e1, 3);
-            HasNext(e1, 4);
-            NoNext(e1);
-        }
-
-        [Fact]
-        public void Memoize2()
-        {
-            var rng = Enumerable.Range(0, 5).Memoize();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            HasNext(e1, 3);
-            HasNext(e1, 4);
-            NoNext(e1);
-
-            var e2 = rng.GetEnumerator();
-            HasNext(e2, 0);
-            HasNext(e2, 1);
-            HasNext(e2, 2);
-            HasNext(e2, 3);
-            HasNext(e2, 4);
-            NoNext(e2);
-        }
-
-        [Fact]
-        public void Memoize3()
-        {
-            var rng = Enumerable.Range(0, 5).Memoize();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-
-            var e2 = rng.GetEnumerator();
-            HasNext(e1, 3);
-            HasNext(e2, 0);
-            HasNext(e2, 1);
-            HasNext(e1, 4);
-            HasNext(e2, 2);
-            NoNext(e1);
-
-            HasNext(e2, 3);
-            HasNext(e2, 4);
-            NoNext(e2);
-        }
-
-        [Fact]
-        public void Memoize4()
-        {
-            var rng = Enumerable.Range(0, 5).Memoize(2);
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-
-            var e2 = rng.GetEnumerator();
-            HasNext(e2, 0);
-            HasNext(e2, 1);
-            HasNext(e2, 2);
-
-            var e3 = rng.GetEnumerator();
-            AssertThrows<InvalidOperationException>(() => e3.MoveNext());
-        }
-
-        [Fact]
-        public void Memoize6()
-        {
-            var ex = new MyException();
-            var rng = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw<int>(ex)).Memoize();
-
-            var e1 = rng.GetEnumerator();
-            var e2 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            AssertThrows<MyException>(() => e1.MoveNext());
-
-            HasNext(e2, 0);
-            HasNext(e2, 1);
-            AssertThrows<MyException>(() => e2.MoveNext());
-        }
-
-        [Fact]
-        public void Memoize7()
-        {
-            var rng = Enumerable.Range(0, 5).Memoize();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            e1.Dispose();
-
-            var e2 = rng.GetEnumerator();
-            HasNext(e2, 0);
-            HasNext(e2, 1);
-            e2.Dispose();
-
-            var e3 = rng.GetEnumerator();
-            HasNext(e3, 0);
-            HasNext(e3, 1);
-            HasNext(e3, 2);
-            HasNext(e3, 3);
-            HasNext(e3, 4);
-            NoNext(e3);
-        }
-
-        [Fact]
-        public void Memoize8()
-        {
-            var rng = Enumerable.Range(0, 5).Memoize();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-
-            rng.Dispose();
-            AssertThrows<ObjectDisposedException>(() => e1.MoveNext());
-            AssertThrows<ObjectDisposedException>(() => rng.GetEnumerator());
-            AssertThrows<ObjectDisposedException>(() => ((IEnumerable)rng).GetEnumerator());
-        }
-
-        [Fact]
-        public void Memoize9()
-        {
-            var rng = Enumerable.Range(0, 5).Memoize();
-
-            var e1 = ((IEnumerable)rng).GetEnumerator();
-            Assert.True(e1.MoveNext());
-            Assert.Equal(0, (int)e1.Current);
-        }
-
-        [Fact]
-        public void Memoize10()
-        {
-            var rnd = Rand().Take(1000).Memoize();
-            Assert.True(rnd.Zip(rnd, (l, r) => l == r).All(x => x));
-        }
-
-        [Fact]
-        public void MemoizeLambda_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Memoize<int, int>(null, xs => xs));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Memoize<int, int>(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void MemoizeLambda()
-        {
-            var n = 0;
-            var res = Enumerable.Range(0, 10).Do(_ => n++).Memoize(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList();
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2)));
-            Assert.Equal(4, n);
-        }
-
-        [Fact]
-        public void MemoizeLimitedLambda_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Memoize<int, int>(null, 2, xs => xs));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Memoize<int, int>(new[] { 1 }, 2, null));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Memoize<int, int>(new[] { 1 }, 0, xs => xs));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Memoize<int, int>(new[] { 1 }, -1, xs => xs));
-        }
-
-        [Fact]
-        public void MemoizeLimitedLambda()
-        {
-            var n = 0;
-            var res = Enumerable.Range(0, 10).Do(_ => n++).Memoize(2, xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList();
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2)));
-            Assert.Equal(4, n);
-        }
-
-        private static readonly Random Random = new Random();
-
-        private static IEnumerable<int> Rand()
-        {
-            while (true)
-            {
-                yield return Random.Next();
-            }
-        }
-
-        private static IEnumerable<int> Tick(Action<int> t)
-        {
-            var i = 0;
-            while (true)
-            {
-                t(i);
-                yield return i++;
-            }
-        }
-    }
-}

+ 0 - 38
Ix.NET/Source/System.Interactive.Tests/MinByTest.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;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class MinByTest : Tests
-    {
-        [Fact]
-        public void MinBy_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MinBy(null, (int x) => x));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MinBy(new[] { 1 }, default(Func<int, int>)));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MinBy(null, (int x) => x, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MinBy(new[] { 1 }, default, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.MinBy(new[] { 1 }, (int x) => x, null));
-        }
-
-        [Fact]
-        public void MinBy()
-        {
-            var res = new[] { 2, 5, 0, 7, 4, 3, 6, 2, 1 }.MinBy(x => x % 3);
-            Assert.True(res.SequenceEqual(new[] { 0, 3, 6 }));
-        }
-
-        [Fact]
-        public void MinBy_Empty()
-        {
-            AssertThrows<InvalidOperationException>(() => Enumerable.Empty<int>().MinBy(x => x));
-        }
-    }
-}

+ 0 - 36
Ix.NET/Source/System.Interactive.Tests/MinTest.cs

@@ -1,36 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class MinTest : Tests
-    {
-        [Fact]
-        public void Min_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Min(null, Comparer<int>.Default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Min(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void Min()
-        {
-            Assert.Equal(3, new[] { 5, 3, 7 }.Min(new Mod3Comparer()));
-        }
-
-        private class Mod3Comparer : IComparer<int>
-        {
-            public int Compare(int x, int y)
-            {
-                return Comparer<int>.Default.Compare(x % 3, y % 3);
-            }
-        }
-    }
-}

+ 0 - 23
Ix.NET/Source/System.Interactive.Tests/NopObserver.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;
-
-namespace Tests
-{
-    public class NopObserver<T> : IObserver<T>
-    {
-        public void OnCompleted()
-        {
-        }
-
-        public void OnError(Exception error)
-        {
-        }
-
-        public void OnNext(T value)
-        {
-        }
-    }
-}

+ 0 - 86
Ix.NET/Source/System.Interactive.Tests/OnErrorResumeNextTest.cs

@@ -1,86 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class OnErrorResumeNextTest : Tests
-    {
-        [Fact]
-        public void OnErrorResumeNext_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.OnErrorResumeNext<int>(null, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.OnErrorResumeNext<int>(new[] { 1 }, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.OnErrorResumeNext<int>(default));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.OnErrorResumeNext<int>(default(IEnumerable<IEnumerable<int>>)));
-        }
-
-        [Fact]
-        public void OnErrorResumeNext1()
-        {
-            var xs = new[] { 1, 2 };
-            var ys = new[] { 3, 4 };
-
-            var res = xs.OnErrorResumeNext(ys);
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 }));
-        }
-
-        [Fact]
-        public void OnErrorResumeNext2()
-        {
-            var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw<int>(new MyException()));
-            var ys = new[] { 3, 4 };
-
-            var res = xs.OnErrorResumeNext(ys);
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 }));
-        }
-
-        [Fact]
-        public void OnErrorResumeNext3()
-        {
-            var xs = new[] { 1, 2 };
-            var ys = new[] { 3, 4 };
-            var zs = new[] { 5, 6 };
-
-            var res = EnumerableEx.OnErrorResumeNext(xs, ys, zs);
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5, 6 }));
-        }
-
-        [Fact]
-        public void OnErrorResumeNext4()
-        {
-            var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw<int>(new MyException()));
-            var ys = new[] { 3, 4 };
-            var zs = new[] { 5, 6 };
-
-            var res = EnumerableEx.OnErrorResumeNext(xs, ys, zs);
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5, 6 }));
-        }
-
-        [Fact]
-        public void OnErrorResumeNext5()
-        {
-            var xs = new[] { 1, 2 };
-            var ys = new[] { 3, 4 };
-
-            var res = new[] { xs, ys }.OnErrorResumeNext();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 }));
-        }
-
-        [Fact]
-        public void OnErrorResumeNext6()
-        {
-            var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw<int>(new MyException()));
-            var ys = new[] { 3, 4 };
-
-            var res = new[] { xs, ys }.OnErrorResumeNext();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 }));
-        }
-    }
-}

+ 0 - 284
Ix.NET/Source/System.Interactive.Tests/PublishTest.cs

@@ -1,284 +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.Text;
-using System.Linq;
-using Xunit;
-using System.Collections;
-
-namespace Tests
-{
-    public class PublishTest : Tests
-    {
-        [Fact]
-        public void Publish_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Publish<int>(null));
-        }
-
-        [Fact]
-        public void Publish0()
-        {
-            var n = 0;
-            var rng = Tick(i => n += i).Publish();
-
-            var e1 = rng.GetEnumerator();
-            var e2 = rng.GetEnumerator();
-
-            HasNext(e1, 0);
-            Assert.Equal(0, n);
-
-            HasNext(e1, 1);
-            Assert.Equal(1, n);
-
-            HasNext(e1, 2);
-            Assert.Equal(3, n);
-            HasNext(e2, 0);
-            Assert.Equal(3, n);
-
-            HasNext(e1, 3);
-            Assert.Equal(6, n);
-            HasNext(e2, 1);
-            Assert.Equal(6, n);
-
-            HasNext(e2, 2);
-            Assert.Equal(6, n);
-            HasNext(e2, 3);
-            Assert.Equal(6, n);
-
-            HasNext(e2, 4);
-            Assert.Equal(10, n);
-            HasNext(e1, 4);
-            Assert.Equal(10, n);
-        }
-
-        [Fact]
-        public void Publish1()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            HasNext(e1, 3);
-            HasNext(e1, 4);
-            NoNext(e1);
-        }
-
-        [Fact]
-        public void Publish2()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = rng.GetEnumerator();
-            var e2 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e2, 0);
-            HasNext(e1, 1);
-            HasNext(e2, 1);
-            HasNext(e1, 2);
-            HasNext(e2, 2);
-            HasNext(e1, 3);
-            HasNext(e2, 3);
-            HasNext(e1, 4);
-            HasNext(e2, 4);
-            NoNext(e1);
-            NoNext(e2);
-        }
-
-        [Fact]
-        public void Publish3()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = rng.GetEnumerator();
-            var e2 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            HasNext(e1, 3);
-            HasNext(e1, 4);
-            HasNext(e2, 0);
-            HasNext(e2, 1);
-            HasNext(e2, 2);
-            HasNext(e2, 3);
-            HasNext(e2, 4);
-            NoNext(e1);
-            NoNext(e2);
-        }
-
-        [Fact]
-        public void Publish4()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            var e2 = rng.GetEnumerator();
-            HasNext(e1, 3);
-            HasNext(e1, 4);
-            HasNext(e2, 3);
-            HasNext(e2, 4);
-            NoNext(e1);
-            NoNext(e2);
-        }
-
-        [Fact]
-        public void Publish5()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            e1.Dispose();
-
-            var e2 = rng.GetEnumerator();
-            HasNext(e2, 3);
-            HasNext(e2, 4);
-            NoNext(e2);
-        }
-
-        [Fact]
-        public void Publish6()
-        {
-            var ex = new MyException();
-            var rng = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw<int>(ex)).Publish();
-
-            var e1 = rng.GetEnumerator();
-            var e2 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            AssertThrows<MyException>(() => e1.MoveNext());
-
-            HasNext(e2, 0);
-            HasNext(e2, 1);
-            AssertThrows<MyException>(() => e2.MoveNext());
-        }
-
-        [Fact]
-        public void Publish7()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-
-            var e2 = rng.GetEnumerator();
-            HasNext(e2, 3);
-            HasNext(e2, 4);
-            NoNext(e2);
-
-            HasNext(e1, 3);
-            HasNext(e1, 4);
-            NoNext(e2);
-
-            var e3 = rng.GetEnumerator();
-            NoNext(e3);
-        }
-
-        [Fact]
-        public void Publish8()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-
-            rng.Dispose();
-            AssertThrows<ObjectDisposedException>(() => e1.MoveNext());
-            AssertThrows<ObjectDisposedException>(() => rng.GetEnumerator());
-            AssertThrows<ObjectDisposedException>(() => ((IEnumerable)rng).GetEnumerator());
-        }
-
-        [Fact]
-        public void Publish9()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = ((IEnumerable)rng).GetEnumerator();
-            Assert.True(e1.MoveNext());
-            Assert.Equal(0, (int)e1.Current);
-        }
-
-        [Fact]
-        public void Publish10()
-        {
-            var rnd = Rand().Take(1000).Publish();
-            Assert.True(rnd.Zip(rnd, (l, r) => l == r).All(x => x));
-        }
-
-        [Fact]
-        public void Publish11()
-        {
-            var rng = Enumerable.Range(0, 5).Publish();
-
-            var e1 = rng.GetEnumerator();
-            var e2 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            e1.Dispose();
-
-            HasNext(e2, 0);
-            HasNext(e2, 1);
-            e2.Dispose();
-
-            var e3 = rng.GetEnumerator();
-            HasNext(e3, 3);
-            HasNext(e3, 4);
-            NoNext(e3);
-        }
-
-        [Fact]
-        public void PublishLambda_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Publish<int, int>(null, xs => xs));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Publish<int, int>(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void PublishLambda()
-        {
-            var n = 0;
-            var res = Enumerable.Range(0, 10).Do(_ => n++).Publish(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList();
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2)));
-            Assert.Equal(4, n);
-        }
-
-        private static readonly Random Random = new Random();
-
-        private static IEnumerable<int> Rand()
-        {
-            while (true)
-            {
-                yield return Random.Next();
-            }
-        }
-
-        private static IEnumerable<int> Tick(Action<int> t)
-        {
-            var i = 0;
-            while (true)
-            {
-                t(i);
-                yield return i++;
-            }
-        }
-    }
-
-    internal class MyException : Exception
-    {
-    }
-}

+ 0 - 163
Ix.NET/Source/System.Interactive.Tests/QueryableParityTest.cs

@@ -1,163 +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.ComponentModel;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using Xunit;
-
-namespace Tests
-{
-    public class QueryableParity : Tests
-    {
-        [Fact]
-        public void Queryable_Enumerable_Parity()
-        {
-            var enu = typeof(EnumerableEx).GetRuntimeMethods().Where(m => m.IsStatic && m.IsPublic).ToList();
-            var qry = typeof(QueryableEx).GetRuntimeMethods().Where(m => m.IsStatic && m.IsPublic).ToList();
-
-            var onlyInObs = enu.Select(m => m.Name).Except(qry.Select(m => m.Name)).Except(new[] { "ForEach", "ToEnumerable", "Multicast", "GetAwaiter", "ToEvent", "ToEventPattern", "ForEachAsync" }).ToList();
-            var onlyInQbs = qry.Select(m => m.Name).Except(enu.Select(m => m.Name)).Except(new[] { "ToQueryable", "get_Provider", "Empty", "Range" }).ToList();
-
-            Assert.True(onlyInObs.Count == 0, "Missing Queryable operator: " + string.Join(", ", onlyInObs.ToArray()));
-            Assert.True(onlyInQbs.Count == 0, "Missing Enumerable operator: " + string.Join(", ", onlyInQbs.ToArray()));
-
-            var enus = enu.GroupBy(m => m.Name);
-            var qrys = qry.GroupBy(m => m.Name);
-            var mtch = (from o in enus
-                        join q in qrys on o.Key equals q.Key
-                        select new { Name = o.Key, Enumerable = o.ToList(), Queryable = q.ToList() })
-                       .ToList();
-
-            bool filterReturn(Type t)
-            {
-                if (t.GetTypeInfo().IsGenericType)
-                {
-                    var gd = t.GetGenericTypeDefinition();
-                    if (gd == typeof(IBuffer<>))
-                    {
-                        return false;
-                    }
-                }
-                return true;
-            }
-
-            bool filterHelper(MethodInfo m)
-            {
-                return !m.IsDefined(typeof(EditorBrowsableAttribute), false);
-            }
-
-            foreach (var group in mtch)
-            {
-                var oss = group.Enumerable
-                    .Where(m => filterReturn(m.ReturnType))
-                    .Select(m => GetSignature(m, false))
-                    .OrderBy(x => x).ToList();
-
-                var qss = group.Queryable
-                    .Where(m => filterHelper(m))
-                    .Select(m => GetSignature(m, true))
-                    .OrderBy(x => x).ToList();
-
-                if (!group.Name.Equals("Create"))
-                {
-                    Assert.True(oss.SequenceEqual(qss), "Mismatch between QueryableEx and EnumerableEx for " + group.Name);
-                }
-            }
-        }
-
-        public static string GetSignature(MethodInfo m, bool correct)
-        {
-            var ps = m.GetParameters();
-            var pss = ps.AsEnumerable();
-            if (correct && ps.Length > 0 && ps[0].ParameterType == typeof(IQueryProvider))
-            {
-                pss = pss.Skip(1);
-            }
-
-            var gens = m.IsGenericMethod ? string.Format("<{0}>", string.Join(", ", m.GetGenericArguments().Select(a => GetTypeName(a, correct)).ToArray())) : "";
-
-            var pars = string.Join(", ", pss.Select(p => (p.IsDefined(typeof(ParamArrayAttribute)) ? "params " : "") + GetTypeName(p.ParameterType, correct) + " " + p.Name).ToArray());
-            if (m.IsDefined(typeof(ExtensionAttribute)))
-            {
-                if (pars.StartsWith("IQbservable") || pars.StartsWith("IQueryable"))
-                {
-                    pars = "this " + pars;
-                }
-            }
-
-            return string.Format("{0} {1}{2}({3})", GetTypeName(m.ReturnType, correct), m.Name, gens, pars);
-        }
-
-        public static string GetTypeName(Type t, bool correct)
-        {
-            if (t.GetTypeInfo().IsGenericType)
-            {
-                var gtd = t.GetGenericTypeDefinition();
-                if (gtd == typeof(Expression<>))
-                {
-                    return GetTypeName(t.GenericTypeArguments[0], false);
-                }
-
-                var args = string.Join(", ", t.GenericTypeArguments.Select(a => GetTypeName(a, false)).ToArray());
-
-                var len = t.Name.IndexOf('`');
-                var name = len >= 0 ? t.Name.Substring(0, len) : t.Name;
-                if (correct && name == "IQbservable")
-                {
-                    name = "IObservable";
-                }
-
-                if (correct && name == "IQueryable")
-                {
-                    name = "IEnumerable";
-                }
-
-                return string.Format("{0}<{1}>", name, args);
-            }
-
-            if (t.IsArray)
-            {
-                return GetTypeName(t.GetElementType(), correct) + "[]";
-            }
-
-            return t.Name;
-        }
-
-        [Fact]
-        public void QueryableRetarget1()
-        {
-            var res = QueryableEx.Provider.Empty<int>().AsEnumerable().ToList();
-            Assert.True(res.SequenceEqual(new int[0]));
-        }
-
-        [Fact]
-        public void QueryableRetarget2()
-        {
-            var res = QueryableEx.Provider.Return(42).AsEnumerable().ToList();
-            Assert.True(res.SequenceEqual(new[] { 42 }));
-        }
-
-        [Fact]
-        public void QueryableRetarget3()
-        {
-#if NETCOREAPP2_1 || WINDOWS_UWP
-            var res = QueryableEx.TakeLast(Enumerable.Range(0, 10).AsQueryable(), 2).AsEnumerable().ToList();
-#else
-            var res = Enumerable.Range(0, 10).AsQueryable().TakeLast(2).AsEnumerable().ToList();
-#endif
-            Assert.True(res.SequenceEqual(new[] { 8, 9 }));
-        }
-
-        [Fact]
-        public void QueryableRetarget4()
-        {
-            var res = QueryableEx.Provider.Range(0, 10).AsEnumerable().ToList();
-            Assert.True(res.SequenceEqual(Enumerable.Range(0, 10)));
-        }
-    }
-}

+ 0 - 55
Ix.NET/Source/System.Interactive.Tests/RepeatTest.cs

@@ -1,55 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class RepeatTest : Tests
-    {
-        [Fact]
-        public void RepeatElementInfinite()
-        {
-            var xs = EnumerableEx.Repeat(42).Take(1000);
-            Assert.True(xs.All(x => x == 42));
-            Assert.True(xs.Count() == 1000);
-        }
-
-        [Fact]
-        public void RepeatSequence_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Repeat<int>(null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Repeat<int>(null, 5));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Repeat<int>(new[] { 1 }, -1));
-        }
-
-        [Fact]
-        public void RepeatSequence1()
-        {
-            var i = 0;
-            var xs = new[] { 1, 2 }.Do(_ => i++).Repeat();
-
-            var res = xs.Take(10).ToList();
-            Assert.Equal(10, res.Count);
-            Assert.True(res.Buffer(2).Select(b => b.Sum()).All(x => x == 3));
-            Assert.Equal(10, i);
-        }
-
-        [Fact]
-        public void RepeatSequence2()
-        {
-            var i = 0;
-            var xs = new[] { 1, 2 }.Do(_ => i++).Repeat(5);
-
-            var res = xs.ToList();
-            Assert.Equal(10, res.Count);
-            Assert.True(res.Buffer(2).Select(b => b.Sum()).All(x => x == 3));
-            Assert.Equal(10, i);
-        }
-    }
-}

+ 0 - 55
Ix.NET/Source/System.Interactive.Tests/RetryTest.cs

@@ -1,55 +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 Xunit;
-
-namespace Tests
-{
-    public class RetryTest : Tests
-    {
-
-        [Fact]
-        public void Retry_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Retry<int>(null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Retry<int>(null, 5));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.Retry<int>(new[] { 1 }, -1));
-        }
-
-        [Fact]
-        public void Retry1()
-        {
-            var xs = Enumerable.Range(0, 10);
-
-            var res = xs.Retry();
-            Assert.True(Enumerable.SequenceEqual(res, xs));
-        }
-
-        [Fact]
-        public void Retry2()
-        {
-            var xs = Enumerable.Range(0, 10);
-
-            var res = xs.Retry(2);
-            Assert.True(Enumerable.SequenceEqual(res, xs));
-        }
-
-        [Fact]
-        public void Retry3()
-        {
-            var ex = new MyException();
-            var xs = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw<int>(ex));
-
-            var res = xs.Retry(2);
-            var e = res.GetEnumerator();
-            HasNext(e, 0);
-            HasNext(e, 1);
-            HasNext(e, 0);
-            HasNext(e, 1);
-            AssertThrows<MyException>(() => e.MoveNext(), ex_ => ex == ex_);
-        }
-    }
-}

+ 0 - 21
Ix.NET/Source/System.Interactive.Tests/ReturnTest.cs

@@ -1,21 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class ReturnTest : Tests
-    {
-        [Fact]
-        public void Return()
-        {
-            Assert.Equal(42, EnumerableEx.Return(42).Single());
-        }
-    }
-}

+ 0 - 36
Ix.NET/Source/System.Interactive.Tests/ScanTest.cs

@@ -1,36 +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 Xunit;
-
-namespace Tests
-{
-    public class ScanTest : Tests
-    {
-        [Fact]
-        public void Scan_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Scan<int>(null, (x, y) => x + y));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Scan<int>(new[] { 1 }, null));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Scan<int, int>(null, 0, (x, y) => x + y));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Scan<int, int>(new[] { 1 }, 0, null));
-        }
-
-        [Fact]
-        public void Scan1()
-        {
-            var res = Enumerable.Range(0, 5).Scan((n, x) => n + x).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 1, 3, 6, 10 }));
-        }
-
-        [Fact]
-        public void Scan2()
-        {
-            var res = Enumerable.Range(0, 5).Scan(10, (n, x) => n - x).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 10, 9, 7, 4, 0 }));
-        }
-    }
-}

+ 0 - 27
Ix.NET/Source/System.Interactive.Tests/SelectManyTest.cs

@@ -1,27 +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 Xunit;
-
-namespace Tests
-{
-    public class SelectManyTest : Tests
-    {
-        [Fact]
-        public void SelectMany_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.SelectMany<int, int>(null, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.SelectMany<int, int>(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void SelectMany()
-        {
-            var res = new[] { 1, 2 }.SelectMany(new[] { 'a', 'b', 'c' }).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 'a', 'b', 'c', 'a', 'b', 'c' }));
-        }
-    }
-}

+ 0 - 125
Ix.NET/Source/System.Interactive.Tests/ShareTest.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;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using Xunit;
-using System.Collections;
-
-namespace Tests
-{
-    public class ShareTest : Tests
-    {
-        [Fact]
-        public void Share_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Share<int>(null));
-        }
-
-        [Fact]
-        public void Share1()
-        {
-            var rng = Enumerable.Range(0, 5).Share();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-            HasNext(e1, 3);
-            HasNext(e1, 4);
-            NoNext(e1);
-        }
-
-        [Fact]
-        public void Share2()
-        {
-            var rng = Enumerable.Range(0, 5).Share();
-
-            var e1 = rng.GetEnumerator();
-            var e2 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e2, 1);
-            HasNext(e1, 2);
-            HasNext(e2, 3);
-            HasNext(e1, 4);
-            NoNext(e2);
-            NoNext(e1);
-        }
-
-        [Fact]
-        public void Share3()
-        {
-            var rng = Enumerable.Range(0, 5).Share();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-
-            var e2 = rng.GetEnumerator();
-            HasNext(e2, 3);
-            HasNext(e2, 4);
-            NoNext(e2);
-            NoNext(e1);
-        }
-
-        [Fact]
-        public void Share4()
-        {
-            var rng = Enumerable.Range(0, 5).Share();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-
-            e1.Dispose();
-            Assert.False(e1.MoveNext());
-        }
-
-        [Fact]
-        public void Share5()
-        {
-            var rng = Enumerable.Range(0, 5).Share();
-
-            var e1 = rng.GetEnumerator();
-            HasNext(e1, 0);
-            HasNext(e1, 1);
-            HasNext(e1, 2);
-
-            rng.Dispose();
-            AssertThrows<ObjectDisposedException>(() => e1.MoveNext());
-            AssertThrows<ObjectDisposedException>(() => rng.GetEnumerator());
-            AssertThrows<ObjectDisposedException>(() => ((IEnumerable)rng).GetEnumerator());
-        }
-
-        [Fact]
-        public void Share6()
-        {
-            var rng = Enumerable.Range(0, 5).Share();
-
-            var e1 = ((IEnumerable)rng).GetEnumerator();
-            Assert.True(e1.MoveNext());
-            Assert.Equal(0, (int)e1.Current);
-        }
-
-        [Fact]
-        public void ShareLambda_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Share<int, int>(null, xs => xs));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Share<int, int>(new[] { 1 }, null));
-        }
-
-        [Fact]
-        public void ShareLambda()
-        {
-            var n = 0;
-            var res = Enumerable.Range(0, 10).Do(_ => n++).Share(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList();
-            Assert.True(res.SequenceEqual(new[] { 0 + 1, 2 + 3, 4 + 5, 6 + 7 }));
-            Assert.Equal(8, n);
-        }
-    }
-}

+ 0 - 58
Ix.NET/Source/System.Interactive.Tests/SkipLastTest.cs

@@ -1,58 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class SkipLastTest : Tests
-    {
-        [Fact]
-        public void SkipLast_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.SkipLast<int>(null, 5));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.SkipLast<int>(new[] { 1 }, -1));
-        }
-
-        [Fact]
-        public void SkipLast_Empty()
-        {
-            var e = Enumerable.Empty<int>();
-#if NETCOREAPP2_1 || WINDOWS_UWP
-            var r = EnumerableEx.SkipLast(e, 1).ToList();
-#else
-            var r = e.SkipLast(1).ToList();
-#endif
-            Assert.True(Enumerable.SequenceEqual(r, e));
-        }
-
-        [Fact]
-        public void SkipLast_All()
-        {
-            var e = Enumerable.Range(0, 5);
-#if NETCOREAPP2_1 || WINDOWS_UWP
-            var r = EnumerableEx.SkipLast(e, 0).ToList();
-#else
-            var r = e.SkipLast(0).ToList();
-#endif
-            Assert.True(Enumerable.SequenceEqual(r, e));
-        }
-
-        [Fact]
-        public void SkipLast_Part()
-        {
-            var e = Enumerable.Range(0, 5);
-#if NETCOREAPP2_1 || WINDOWS_UWP
-            var r = EnumerableEx.SkipLast(e, 3).ToList();
-#else
-            var r = e.SkipLast(3).ToList();
-#endif
-            Assert.True(Enumerable.SequenceEqual(r, e.Take(2)));
-        }
-    }
-}

+ 0 - 38
Ix.NET/Source/System.Interactive.Tests/StartWithTest.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;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class StartWithTest : Tests
-    {
-        [Fact]
-        public void StartWith_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.StartWith<int>(null, 5));
-        }
-
-        [Fact]
-        public void StartWith1()
-        {
-            var e = Enumerable.Range(1, 5);
-            var r = e.StartWith(0).ToList();
-            Assert.True(Enumerable.SequenceEqual(r, Enumerable.Range(0, 6)));
-        }
-
-        [Fact]
-        public void StartWith2()
-        {
-            var oops = false;
-            var e = Enumerable.Range(1, 5).Do(_ => oops = true);
-            var r = e.StartWith(0).Take(1).ToList();
-            Assert.False(oops);
-        }
-    }
-}

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

@@ -2,10 +2,9 @@
 
   <PropertyGroup>
     <TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
-    <NoWarn>$(NoWarn);CS0618</NoWarn>
+    <NoWarn>$(NoWarn);CS0618;CS8603;CS8625</NoWarn>
   </PropertyGroup>
 
-
   <ItemGroup>
     <Content Include="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -23,7 +22,6 @@
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
     <PackageReference Include="FluentAssertions" Version="5.9.0" />
-    
     <PackageReference Include="xunit" Version="2.4.1" />
   </ItemGroup>
 

+ 6 - 6
Ix.NET/Source/System.Interactive.Tests/System/Linq/Operators/Using.cs

@@ -26,12 +26,12 @@ namespace Tests
             Assert.Null(d);
 
             var d1 = default(MyDisposable);
-            xs.ForEach(_ => { d1 = d; Assert.NotNull(d1); Assert.False(d1.Done); });
-            Assert.True(d1.Done);
+            xs.ForEach(_ => { d1 = d; Assert.NotNull(d1); Assert.False(d1!.Done); });
+            Assert.True(d1!.Done);
 
             var d2 = default(MyDisposable);
-            xs.ForEach(_ => { d2 = d; Assert.NotNull(d2); Assert.False(d2.Done); });
-            Assert.True(d2.Done);
+            xs.ForEach(_ => { d2 = d; Assert.NotNull(d2); Assert.False(d2!.Done); });
+            Assert.True(d2!.Done);
 
             Assert.NotSame(d1, d2);
         }
@@ -45,7 +45,7 @@ namespace Tests
             Assert.Null(d);
 
             AssertThrows<MyException>(() => xs.ForEach(_ => { }));
-            Assert.True(d.Done);
+            Assert.True(d!.Done);
         }
 
         [Fact]
@@ -57,7 +57,7 @@ namespace Tests
             Assert.Null(d);
 
             AssertThrows<MyException>(() => xs.ForEach(_ => { }));
-            Assert.True(d.Done);
+            Assert.True(d!.Done);
         }
 
         private sealed class MyDisposable : IDisposable

+ 0 - 73
Ix.NET/Source/System.Interactive.Tests/TakeLastTest.cs

@@ -1,73 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class TakeLastTest : Tests
-    {
-        [Fact]
-        public void TakeLast_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.TakeLast<int>(null, 5));
-            AssertThrows<ArgumentOutOfRangeException>(() => EnumerableEx.TakeLast<int>(new[] { 1 }, -1));
-        }
-
-        [Fact]
-        public void TakeLast_TakeZero()
-        {
-            var e = Enumerable.Range(1, 5);
-#if NETCOREAPP2_1 || WINDOWS_UWP
-            var r = EnumerableEx.TakeLast(e, 0).ToList();
-#else
-            var r = e.TakeLast(0).ToList();
-#endif
-            Assert.True(Enumerable.SequenceEqual(r, Enumerable.Empty<int>()));
-        }
-
-        [Fact]
-        public void TakeLast_Empty()
-        {
-            var e = Enumerable.Empty<int>();
-
-#if NETCOREAPP2_1 || WINDOWS_UWP
-            var r = EnumerableEx.TakeLast(e, 1).ToList();
-#else
-            var r = e.TakeLast(1).ToList();
-#endif
-            Assert.True(Enumerable.SequenceEqual(r, e));
-        }
-
-        [Fact]
-        public void TakeLast_All()
-        {
-            var e = Enumerable.Range(0, 5);
-
-#if NETCOREAPP2_1 || WINDOWS_UWP
-            var r = EnumerableEx.TakeLast(e, 5).ToList();
-#else
-            var r = e.TakeLast(5).ToList();
-#endif
-
-            Assert.True(Enumerable.SequenceEqual(r, e));
-        }
-
-        [Fact]
-        public void TakeLast_Part()
-        {
-            var e = Enumerable.Range(0, 5);
-#if NETCOREAPP2_1 || WINDOWS_UWP
-            var r = EnumerableEx.TakeLast(e, 3).ToList();
-#else
-            var r = e.TakeLast(3).ToList();
-#endif
-            Assert.True(Enumerable.SequenceEqual(r, e.Skip(2)));
-        }
-    }
-}

+ 0 - 31
Ix.NET/Source/System.Interactive.Tests/ThrowTest.cs

@@ -1,31 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class ThrowTest : Tests
-    {
-        [Fact]
-        public void Throw_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Throw<int>(null));
-        }
-
-        [Fact]
-        public void Throw()
-        {
-            var ex = new MyException();
-            var xs = EnumerableEx.Throw<int>(ex);
-
-            var e = xs.GetEnumerator();
-            AssertThrows<MyException>(() => e.MoveNext());
-        }
-    }
-}

+ 0 - 75
Ix.NET/Source/System.Interactive.Tests/UsingTest.cs

@@ -1,75 +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.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class UsingTest : Tests
-    {
-        [Fact]
-        public void Using_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Using<int, MyDisposable>(null, d => new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.Using<int, MyDisposable>(() => new MyDisposable(), null));
-        }
-
-        [Fact]
-        public void Using1()
-        {
-            var d = default(MyDisposable);
-
-            var xs = EnumerableEx.Using(() => d = new MyDisposable(), d_ => new[] { 1 });
-            Assert.Null(d);
-
-            var d1 = default(MyDisposable);
-            xs.ForEach(_ => { d1 = d; Assert.NotNull(d1); Assert.False(d1.Done); });
-            Assert.True(d1.Done);
-
-            var d2 = default(MyDisposable);
-            xs.ForEach(_ => { d2 = d; Assert.NotNull(d2); Assert.False(d2.Done); });
-            Assert.True(d2.Done);
-
-            Assert.NotSame(d1, d2);
-        }
-
-        [Fact]
-        public void Using2()
-        {
-            var d = default(MyDisposable);
-
-            var xs = EnumerableEx.Using(() => d = new MyDisposable(), d_ => EnumerableEx.Throw<int>(new MyException()));
-            Assert.Null(d);
-
-            AssertThrows<MyException>(() => xs.ForEach(_ => { }));
-            Assert.True(d.Done);
-        }
-
-        [Fact]
-        public void Using3()
-        {
-            var d = default(MyDisposable);
-
-            var xs = EnumerableEx.Using<int, MyDisposable>(() => d = new MyDisposable(), d_ => { throw new MyException(); });
-            Assert.Null(d);
-
-            AssertThrows<MyException>(() => xs.ForEach(_ => { }));
-            Assert.True(d.Done);
-        }
-
-        private class MyDisposable : IDisposable
-        {
-            public bool Done;
-
-            public void Dispose()
-            {
-                Done = true;
-            }
-        }
-    }
-}

+ 0 - 38
Ix.NET/Source/System.Interactive.Tests/WhileTest.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;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using Xunit;
-
-namespace Tests
-{
-    public class WhileTest : Tests
-    {
-        [Fact]
-        public void While_Arguments()
-        {
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.While<int>(null, new[] { 1 }));
-            AssertThrows<ArgumentNullException>(() => EnumerableEx.While<int>(() => true, null));
-        }
-
-        [Fact]
-        public void While1()
-        {
-            var x = 5;
-            var res = EnumerableEx.While(() => x > 0, EnumerableEx.Defer(() => new[] { x }).Do(_ => x--)).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new[] { 5, 4, 3, 2, 1 }));
-        }
-
-        [Fact]
-        public void While2()
-        {
-            var x = 0;
-            var res = EnumerableEx.While(() => x > 0, EnumerableEx.Defer(() => new[] { x }).Do(_ => x--)).ToList();
-            Assert.True(Enumerable.SequenceEqual(res, new int[0]));
-        }
-    }
-}

+ 2 - 2
Ix.NET/Source/System.Interactive/System/Linq/Operators/Catch.cs

@@ -82,7 +82,7 @@ namespace System.Linq
             {
                 while (true)
                 {
-                    var c = default(TSource);
+                    TSource c;
 
                     try
                     {
@@ -121,7 +121,7 @@ namespace System.Linq
 
                 while (true)
                 {
-                    var c = default(TSource);
+                    TSource c;
 
                     try
                     {

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

@@ -115,7 +115,7 @@ namespace System.Linq
         {
             private IRefCountList<T> _buffer;
             private bool _disposed;
-            private Exception _error;
+            private Exception? _error;
             private IEnumerator<T> _source;
             private bool _stopped;
 

+ 6 - 4
Ix.NET/Source/System.Interactive/System/Linq/Operators/Publish.cs

@@ -61,9 +61,11 @@ namespace System.Linq
 
         private sealed class PublishedBuffer<T> : IBuffer<T>
         {
+            private readonly object _gate = new object();
+
             private RefCountList<T> _buffer;
             private bool _disposed;
-            private Exception _error;
+            private Exception? _error;
             private IEnumerator<T> _source;
             private bool _stopped;
 
@@ -81,7 +83,7 @@ namespace System.Linq
                 }
 
                 var i = default(int);
-                lock (_source)
+                lock (_gate)
                 {
                     i = _buffer.Count;
                     _buffer.ReaderCount++;
@@ -102,7 +104,7 @@ namespace System.Linq
 
             public void Dispose()
             {
-                lock (_source)
+                lock (_gate)
                 {
                     if (!_disposed)
                     {
@@ -131,7 +133,7 @@ namespace System.Linq
                         var hasValue = default(bool);
                         var current = default(T);
 
-                        lock (_source)
+                        lock (_gate)
                         {
                             if (i >= _buffer.Count)
                             {

+ 2 - 2
Ix.NET/Source/System.Interactive/System/Linq/Yielder.cs

@@ -9,7 +9,7 @@ namespace System.Linq
     internal sealed class Yielder<T> : IYielder<T>, IAwaitable, IAwaiter
     {
         private readonly Action<Yielder<T>> _create;
-        private Action _continuation;
+        private Action? _continuation;
         private bool _hasValue;
         private bool _running;
         private bool _stopped;
@@ -62,7 +62,7 @@ namespace System.Linq
             else
             {
                 _hasValue = false;
-                _continuation();
+                _continuation!();
             }
 
             return !_stopped && _hasValue;

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

@@ -5,7 +5,6 @@
     <NoWarn>$(NoWarn);CS0618</NoWarn>
   </PropertyGroup>
 
-
   <ItemGroup>
     <Content Include="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

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

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

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

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

File diff suppressed because it is too large
+ 197 - 197
Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncQueryable.Generated.cs


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -144,9 +143,6 @@ namespace System.Linq
 
             public SelectEnumerableAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, TResult> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -204,9 +200,6 @@ namespace System.Linq
 
             public SelectIListIterator(IList<TSource> source, Func<TSource, TResult> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -321,9 +314,6 @@ namespace System.Linq
 
             public SelectEnumerableAsyncIteratorWithTask(IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -383,9 +373,6 @@ namespace System.Linq
 
             public SelectEnumerableAsyncIteratorWithTaskAndCancellation(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -449,9 +436,6 @@ namespace System.Linq
 
             public SelectIListIteratorWithTask(IList<TSource> source, Func<TSource, ValueTask<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }
@@ -571,9 +555,6 @@ namespace System.Linq
 
             public SelectIListIteratorWithTaskAndCancellation(IList<TSource> source, Func<TSource, CancellationToken, ValueTask<TResult>> selector)
             {
-                Debug.Assert(source != null);
-                Debug.Assert(selector != null);
-
                 _source = source;
                 _selector = selector;
             }

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

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

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

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

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

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

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

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

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

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

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

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

Some files were not shown because too many files changed in this diff