diff --git a/Ix.NET/Source/Directory.build.props b/Ix.NET/Source/Directory.build.props index 19fe901cb8..0a10685f58 100644 --- a/Ix.NET/Source/Directory.build.props +++ b/Ix.NET/Source/Directory.build.props @@ -16,8 +16,8 @@ embedded true true - - 8.0 + + preview diff --git a/Ix.NET/Source/Directory.build.targets b/Ix.NET/Source/Directory.build.targets index 7c39361150..21169cbed2 100644 --- a/Ix.NET/Source/Directory.build.targets +++ b/Ix.NET/Source/Directory.build.targets @@ -10,7 +10,7 @@ $(DefineConstants);NO_ARRAY_EMPTY;NO_TASK_FROMEXCEPTION - + $(DefineConstants);USE_ASYNC_ITERATOR @@ -21,11 +21,6 @@ $(AssemblyName) ($(TargetFramework)) - - - - - true cobertura diff --git a/Ix.NET/Source/NuGet.config b/Ix.NET/Source/NuGet.config new file mode 100644 index 0000000000..0c3b9fec51 --- /dev/null +++ b/Ix.NET/Source/NuGet.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Ix.NET/Source/System.Interactive.Async.Providers/System.Interactive.Async.Providers.csproj b/Ix.NET/Source/System.Interactive.Async.Providers/System.Interactive.Async.Providers.csproj index 4a73d82cde..95296f404d 100644 --- a/Ix.NET/Source/System.Interactive.Async.Providers/System.Interactive.Async.Providers.csproj +++ b/Ix.NET/Source/System.Interactive.Async.Providers/System.Interactive.Async.Providers.csproj @@ -3,7 +3,7 @@ Interactive Extensions Async Providers Library used to build query providers and express queries over async enumerable sequences. Interactive Extensions - Async Providers Library - net45;net46;netstandard2.0;netstandard2.1;netcoreapp3.0 + net461;netstandard2.0;netstandard2.1;netcoreapp3.0 Ix;Interactive;Extensions;Enumerable;Asynchronous diff --git a/Ix.NET/Source/System.Interactive.Async/System.Interactive.Async.csproj b/Ix.NET/Source/System.Interactive.Async/System.Interactive.Async.csproj index 0c8b157532..3209f92736 100644 --- a/Ix.NET/Source/System.Interactive.Async/System.Interactive.Async.csproj +++ b/Ix.NET/Source/System.Interactive.Async/System.Interactive.Async.csproj @@ -3,7 +3,7 @@ Interactive Extensions Async Library used to express queries over asynchronous enumerable sequences. Interactive Extensions - Async Library - net45;net46;netstandard2.0;netstandard2.1;netcoreapp3.0 + net461;netstandard2.0;netstandard2.1;netcoreapp3.0 Ix;Interactive;Extensions;Enumerable;Asynchronous diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs index a489652e4c..4cb26ab517 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs @@ -94,8 +94,8 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) } try - { - await using (AsyncEnumerableExtensions.ConfigureAwait(winner, false)) + { + await using (winner.ConfigureAwait(false)) { if (!await moveNextWinner.ConfigureAwait(false)) { @@ -204,7 +204,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) try { - await using (AsyncEnumerableExtensions.ConfigureAwait(winner, false)) + await using (winner.ConfigureAwait(false)) { if (!await moveNextWinner.ConfigureAwait(false)) { @@ -246,7 +246,7 @@ private static async Task AwaitMoveNextAsyncAndDispose(Task moveNextAsy { if (enumerator != null) { - await using (AsyncEnumerableExtensions.ConfigureAwait(enumerator, false)) + await using (enumerator.ConfigureAwait(false)) { if (moveNextAsync != null) { diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs index 14346aed72..f58107295c 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs @@ -25,7 +25,7 @@ async IAsyncEnumerator> Core(CancellationToken cancellationToken) { var buffer = new List(count); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { buffer.Add(item); @@ -65,7 +65,7 @@ async IAsyncEnumerator> Core(CancellationToken cancellationToken) var index = 0; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (index++ % skip == 0) { diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs index 9301d9f837..b08ea8afd3 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs @@ -64,7 +64,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) if (err != null) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(err, cancellationToken).ConfigureAwait(false)) + await foreach (var item in err.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -122,7 +122,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) if (err != null) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(err, cancellationToken).ConfigureAwait(false)) + await foreach (var item in err.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -181,7 +181,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) if (err != null) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(err, cancellationToken).ConfigureAwait(false)) + await foreach (var item in err.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Concat.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Concat.cs index ed045bcd70..94d6112a94 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Concat.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Concat.cs @@ -21,9 +21,9 @@ public static IAsyncEnumerable Concat(this IAsyncEnumerable Core(CancellationToken cancellationToken) { - await foreach (var source in AsyncEnumerableExtensions.WithCancellation(sources, cancellationToken).ConfigureAwait(false)) + await foreach (var source in sources.WithCancellation(cancellationToken).ConfigureAwait(false)) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -46,7 +46,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { foreach (var source in sources) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -69,7 +69,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { foreach (var source in sources) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Defer.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Defer.cs index d082be3a54..4949dbfb57 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Defer.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Defer.cs @@ -21,7 +21,7 @@ public static IAsyncEnumerable Defer(Func Core(CancellationToken cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(factory(), cancellationToken).ConfigureAwait(false)) + await foreach (var item in factory().WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -41,7 +41,7 @@ public static IAsyncEnumerable Defer(Func Core(CancellationToken cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation((await factory().ConfigureAwait(false)), cancellationToken).ConfigureAwait(false)) + await foreach (var item in (await factory().ConfigureAwait(false)).WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -62,7 +62,7 @@ public static IAsyncEnumerable Defer(Func Core(CancellationToken cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation((await factory(cancellationToken).ConfigureAwait(false)), cancellationToken).ConfigureAwait(false)) + await foreach (var item in (await factory(cancellationToken).ConfigureAwait(false)).WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Expand.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Expand.cs index 3c5acb5c10..d89d7668f7 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Expand.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Expand.cs @@ -29,7 +29,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) while (queue.Count > 0) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(queue.Dequeue(), cancellationToken).ConfigureAwait(false)) + await foreach (var item in queue.Dequeue().WithCancellation(cancellationToken).ConfigureAwait(false)) { queue.Enqueue(selector(item)); @@ -60,7 +60,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) while (queue.Count > 0) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(queue.Dequeue(), cancellationToken).ConfigureAwait(false)) + await foreach (var item in queue.Dequeue().WithCancellation(cancellationToken).ConfigureAwait(false)) { queue.Enqueue(await selector(item).ConfigureAwait(false)); @@ -92,7 +92,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) while (queue.Count > 0) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(queue.Dequeue(), cancellationToken).ConfigureAwait(false)) + await foreach (var item in queue.Dequeue().WithCancellation(cancellationToken).ConfigureAwait(false)) { queue.Enqueue(await selector(item, cancellationToken).ConfigureAwait(false)); diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Finally.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Finally.cs index 43fb3d52d9..b8d7c3ae39 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Finally.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Finally.cs @@ -25,7 +25,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { try { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -54,7 +54,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { try { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IgnoreElements.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IgnoreElements.cs index 39774de512..1821ba53a0 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IgnoreElements.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IgnoreElements.cs @@ -21,7 +21,7 @@ public static IAsyncEnumerable IgnoreElements(this IAsyncEnume async IAsyncEnumerator Core(CancellationToken cancellationToken) { - await foreach (var _ in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var _ in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { } diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Repeat.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Repeat.cs index 9f8e6a2f75..e6d08eeb97 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Repeat.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Repeat.cs @@ -44,7 +44,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { while (true) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -69,7 +69,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { for (var i = 0; i < count; i++) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Scan.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Scan.cs index b6e49fd733..4e6f9c9102 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Scan.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Scan.cs @@ -63,7 +63,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var res = seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { res = accumulator(res, item); @@ -159,7 +159,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var res = seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { res = await accumulator(res, item).ConfigureAwait(false); @@ -186,7 +186,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var res = seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { res = await accumulator(res, item, cancellationToken).ConfigureAwait(false); diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Using.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Using.cs index 568a49a02d..40e7c452ad 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Using.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Using.cs @@ -27,7 +27,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { using (var resource = resourceFactory()) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(enumerableFactory(resource), cancellationToken).ConfigureAwait(false)) + await foreach (var item in enumerableFactory(resource).WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -52,7 +52,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { using (var resource = await resourceFactory().ConfigureAwait(false)) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation((await enumerableFactory(resource).ConfigureAwait(false)), cancellationToken).ConfigureAwait(false)) + await foreach (var item in (await enumerableFactory(resource).ConfigureAwait(false)).WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } @@ -78,7 +78,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { using (var resource = await resourceFactory(cancellationToken).ConfigureAwait(false)) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation((await enumerableFactory(resource, cancellationToken).ConfigureAwait(false)), cancellationToken).ConfigureAwait(false)) + await foreach (var item in (await enumerableFactory(resource, cancellationToken).ConfigureAwait(false)).WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return item; } diff --git a/Ix.NET/Source/System.Linq.Async.Queryable/System.Linq.Async.Queryable.csproj b/Ix.NET/Source/System.Linq.Async.Queryable/System.Linq.Async.Queryable.csproj index 9c67119aad..4d3f12d038 100644 --- a/Ix.NET/Source/System.Linq.Async.Queryable/System.Linq.Async.Queryable.csproj +++ b/Ix.NET/Source/System.Linq.Async.Queryable/System.Linq.Async.Queryable.csproj @@ -1,7 +1,7 @@  - net45;net46;netstandard2.0;netstandard2.1;netcoreapp3.0 + net461;netstandard2.0;netstandard2.1;netcoreapp3.0 diff --git a/Ix.NET/Source/System.Linq.Async/System.Linq.Async.csproj b/Ix.NET/Source/System.Linq.Async/System.Linq.Async.csproj index 9aa36fea38..06d78d9fee 100644 --- a/Ix.NET/Source/System.Linq.Async/System.Linq.Async.csproj +++ b/Ix.NET/Source/System.Linq.Async/System.Linq.Async.csproj @@ -1,7 +1,7 @@  - net45;net46;netstandard2.0;netstandard2.1;netcoreapp3.0 + net461;netstandard2.0;netstandard2.1;netcoreapp3.0 @@ -23,7 +23,7 @@ - + @@ -87,8 +87,4 @@ - - - - diff --git a/Ix.NET/Source/System.Linq.Async/System/Collections/Generic/IAsyncEnumerable.cs b/Ix.NET/Source/System.Linq.Async/System/Collections/Generic/IAsyncEnumerable.cs deleted file mode 100644 index bfad96edd0..0000000000 --- a/Ix.NET/Source/System.Linq.Async/System/Collections/Generic/IAsyncEnumerable.cs +++ /dev/null @@ -1,34 +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. - -// See https://github.com/dotnet/csharplang/blob/master/proposals/async-streams.md for the definition of this interface -// and the design rationale. (8/30/2017) - -#if !HAS_ASYNCENUMERABLE - -using System.Threading; - -namespace System.Collections.Generic -{ - /// - /// Asynchronous version of the interface, allowing elements of the enumerable sequence to be retrieved asynchronously. - /// - /// Element type. - public interface IAsyncEnumerable - { - /// - /// Gets an asynchronous enumerator over the sequence. - /// - /// Cancellation token used to cancel the enumeration. - /// Enumerator for asynchronous enumeration over the sequence. - IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default); - } -} - -#else -using System.Runtime.CompilerServices; - -[assembly: TypeForwardedTo(typeof(System.Collections.Generic.IAsyncEnumerable<>))] - -#endif diff --git a/Ix.NET/Source/System.Linq.Async/System/Collections/Generic/IAsyncEnumerator.cs b/Ix.NET/Source/System.Linq.Async/System/Collections/Generic/IAsyncEnumerator.cs deleted file mode 100644 index 39993ea0cd..0000000000 --- a/Ix.NET/Source/System.Linq.Async/System/Collections/Generic/IAsyncEnumerator.cs +++ /dev/null @@ -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. - -// See https://github.com/dotnet/csharplang/blob/master/proposals/async-streams.md for the definition of this interface -// and the design rationale. (8/30/2017) - -#if !HAS_ASYNCENUMERABLE - -using System.Threading.Tasks; - -namespace System.Collections.Generic -{ - /// - /// Asynchronous version of the interface, allowing elements to be retrieved asynchronously. - /// - /// Element type. - public interface IAsyncEnumerator : IAsyncDisposable - { - /// - /// Gets the current element in the iteration. - /// - T Current { get; } - - /// - /// Advances the enumerator to the next element in the sequence, returning the result asynchronously. - /// - /// - /// Task containing the result of the operation: true if the enumerator was successfully advanced - /// to the next element; false if the enumerator has passed the end of the sequence. - /// - ValueTask MoveNextAsync(); - } -} - -#else -using System.Runtime.CompilerServices; - -[assembly: TypeForwardedTo(typeof(System.Collections.Generic.IAsyncEnumerator<>))] -#endif diff --git a/Ix.NET/Source/System.Linq.Async/System/IAsyncDisposable.cs b/Ix.NET/Source/System.Linq.Async/System/IAsyncDisposable.cs deleted file mode 100644 index 2a7e69b3d9..0000000000 --- a/Ix.NET/Source/System.Linq.Async/System/IAsyncDisposable.cs +++ /dev/null @@ -1,24 +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. - -// See https://github.com/dotnet/csharplang/blob/master/proposals/async-streams.md for the definition of this interface -// and the design rationale. (8/30/2017) - -#if !HAS_ASYNCDISPOSABLE - -using System.Threading.Tasks; - -namespace System -{ - public interface IAsyncDisposable - { - ValueTask DisposeAsync(); - } -} - -#else -using System.Runtime.CompilerServices; - -[assembly: TypeForwardedTo(typeof(System.IAsyncDisposable))] -#endif diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerableHelpers.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerableHelpers.cs index 821c951be2..d3ad271a03 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerableHelpers.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerableHelpers.cs @@ -106,7 +106,7 @@ internal static async Task> ToSet(IAsyncEnumerable source, IEqualit { var set = new Set(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { set.Add(item); } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Aggregate.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Aggregate.cs index 25a2dca49a..e463a008fe 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Aggregate.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Aggregate.cs @@ -115,7 +115,7 @@ static async ValueTask Core(IAsyncEnumerable _source, TAcc { var acc = _seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { acc = _accumulator(acc, item); } @@ -137,7 +137,7 @@ static async ValueTask Core(IAsyncEnumerable _source, TAcc { var acc = _seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { acc = await _accumulator(acc, item).ConfigureAwait(false); } @@ -160,7 +160,7 @@ static async ValueTask Core(IAsyncEnumerable _source, TAcc { var acc = _seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { acc = await _accumulator(acc, item, _cancellationToken).ConfigureAwait(false); } @@ -185,7 +185,7 @@ static async ValueTask Core(IAsyncEnumerable _source, TAccumul { var acc = _seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { acc = _accumulator(acc, item); } @@ -209,7 +209,7 @@ static async ValueTask Core(IAsyncEnumerable _source, TAccumul { var acc = _seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { acc = await _accumulator(acc, item).ConfigureAwait(false); } @@ -234,7 +234,7 @@ static async ValueTask Core(IAsyncEnumerable _source, TAccumul { var acc = _seed; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { acc = await _accumulator(acc, item, _cancellationToken).ConfigureAwait(false); } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/All.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/All.cs index a3a3dcc604..5462922f5d 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/All.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/All.cs @@ -21,7 +21,7 @@ public static ValueTask AllAsync(this IAsyncEnumerable s static async ValueTask Core(IAsyncEnumerable _source, Func _predicate, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (!_predicate(item)) { @@ -44,7 +44,7 @@ internal static ValueTask AllAwaitAsyncCore(this IAsyncEnumerable static async ValueTask Core(IAsyncEnumerable _source, Func> _predicate, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (!await _predicate(item).ConfigureAwait(false)) { @@ -68,7 +68,7 @@ internal static ValueTask AllAwaitWithCancellationAsyncCore(this static async ValueTask Core(IAsyncEnumerable _source, Func> _predicate, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (!await _predicate(item, _cancellationToken).ConfigureAwait(false)) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Any.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Any.cs index 9bfa93f50f..ad259994dd 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Any.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Any.cs @@ -37,7 +37,7 @@ public static ValueTask AnyAsync(this IAsyncEnumerable s static async ValueTask Core(IAsyncEnumerable _source, Func _predicate, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (_predicate(item)) { @@ -60,7 +60,7 @@ internal static ValueTask AnyAwaitAsyncCore(this IAsyncEnumerable static async ValueTask Core(IAsyncEnumerable _source, Func> _predicate, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (await _predicate(item).ConfigureAwait(false)) { @@ -84,7 +84,7 @@ internal static ValueTask AnyAwaitWithCancellationAsyncCore(this static async ValueTask Core(IAsyncEnumerable _source, Func> _predicate, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (await _predicate(item, _cancellationToken).ConfigureAwait(false)) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/AppendPrepend.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/AppendPrepend.cs index 1a21dbda8a..a1191c7aab 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/AppendPrepend.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/AppendPrepend.cs @@ -206,7 +206,7 @@ public override async ValueTask ToArrayAsync(CancellationToken cancel } else { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(cancellationToken).ConfigureAwait(false)) { array[index] = item; ++index; @@ -234,7 +234,7 @@ public override async ValueTask> ToListAsync(CancellationToken can list.Add(_item); } - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(cancellationToken).ConfigureAwait(false)) { list.Add(item); } @@ -395,7 +395,7 @@ public override async ValueTask ToArrayAsync(CancellationToken cancel } else { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(cancellationToken).ConfigureAwait(false)) { array[index] = item; ++index; @@ -421,7 +421,7 @@ public override async ValueTask> ToListAsync(CancellationToken can list.Add(n.Item); } - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(cancellationToken).ConfigureAwait(false)) { list.Add(item); } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Cast.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Cast.cs index 50f221674f..736a3aa119 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Cast.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Cast.cs @@ -28,7 +28,7 @@ public static IAsyncEnumerable Cast(this IAsyncEnumerable Core(CancellationToken cancellationToken) { - await foreach (var obj in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var obj in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return (TResult)obj; } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Concat.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Concat.cs index 3cc9f44abe..25ca35bfe2 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Concat.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Concat.cs @@ -84,7 +84,7 @@ public async ValueTask> ToListAsync(CancellationToken cancellation break; } - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { list.Add(item); } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Contains.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Contains.cs index f347434058..49737cf254 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Contains.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Contains.cs @@ -28,7 +28,7 @@ public static ValueTask ContainsAsync(this IAsyncEnumerable Core(IAsyncEnumerable _source, TSource _value, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (EqualityComparer.Default.Equals(item, _value)) { @@ -45,7 +45,7 @@ static async ValueTask Core(IAsyncEnumerable _source, TSource _va static async ValueTask Core(IAsyncEnumerable _source, TSource _value, IEqualityComparer _comparer, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (_comparer.Equals(item, _value)) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Count.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Count.cs index a6ac535a2e..944b01881c 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Count.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Count.cs @@ -32,7 +32,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Cancellation { var count = 0; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { checked { @@ -57,7 +57,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, int _ind if (_index >= 0) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (_index == 0) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ElementAtOrDefault.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ElementAtOrDefault.cs index 5c77fbc473..8e469a043b 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ElementAtOrDefault.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ElementAtOrDefault.cs @@ -40,7 +40,7 @@ static async ValueTask Core(IAsyncEnumerable _source, int _ind } else { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { if (_index == 0) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Except.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Except.cs index 22e73f372c..e006c481b3 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Except.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Except.cs @@ -28,12 +28,12 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var set = new Set(comparer); - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(second, cancellationToken).ConfigureAwait(false)) + await foreach (var element in second.WithCancellation(cancellationToken).ConfigureAwait(false)) { set.Add(element); } - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(first, cancellationToken).ConfigureAwait(false)) + await foreach (var element in first.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (set.Add(element)) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ForEach.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ForEach.cs index 8ad5d65dcb..4c8b2b64d5 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ForEach.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ForEach.cs @@ -28,7 +28,7 @@ public static Task ForEachAsync(this IAsyncEnumerable source, static async Task Core(IAsyncEnumerable _source, Action _action, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { _action(item); } @@ -48,7 +48,7 @@ static async Task Core(IAsyncEnumerable _source, Action _ { var index = 0; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { _action(item, checked(index++)); } @@ -66,7 +66,7 @@ internal static Task ForEachAwaitAsyncCore(this IAsyncEnumerable _source, Func _action, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { await _action(item).ConfigureAwait(false); } @@ -84,7 +84,7 @@ internal static Task ForEachAwaitWithCancellationAsyncCore(this IAsyncE static async Task Core(IAsyncEnumerable _source, Func _action, CancellationToken _cancellationToken) { - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { await _action(item, _cancellationToken).ConfigureAwait(false); } @@ -104,7 +104,7 @@ static async Task Core(IAsyncEnumerable _source, Func _source, Func Core(CancellationToken cancellationToken) { var set = new Set(comparer); - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(second, cancellationToken).ConfigureAwait(false)) + await foreach (var element in second.WithCancellation(cancellationToken).ConfigureAwait(false)) { set.Add(element); } - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(first, cancellationToken).ConfigureAwait(false)) + await foreach (var element in first.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (set.Remove(element)) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/LastOrDefault.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/LastOrDefault.cs index 66e1f2618d..d0f951256b 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/LastOrDefault.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/LastOrDefault.cs @@ -101,7 +101,7 @@ static async ValueTask> Core(IAsyncEnumerable _source, C var last = default(TSource); var hasLast = false; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { hasLast = true; last = item; @@ -119,7 +119,7 @@ private static async ValueTask> TryGetLast(IAsyncEnumera var last = default(TSource); var hasLast = false; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (predicate(item)) { @@ -136,7 +136,7 @@ private static async ValueTask> TryGetLast(IAsyncEnumera var last = default(TSource); var hasLast = false; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (await predicate(item).ConfigureAwait(false)) { @@ -154,7 +154,7 @@ private static async ValueTask> TryGetLast(IAsyncEnumera var last = default(TSource); var hasLast = false; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (await predicate(item, cancellationToken).ConfigureAwait(false)) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/LongCount.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/LongCount.cs index c48995ea6d..90efd96dd8 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/LongCount.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/LongCount.cs @@ -21,7 +21,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Cancellatio { var count = 0L; - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { checked { @@ -46,7 +46,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func> CreateAsync(IAsyncEn var lookup = new Lookup(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = keySelector(item); var group = lookup.GetGrouping(key, create: true); @@ -110,7 +110,7 @@ internal static async Task> CreateAsync(IAsyncEnumerable< var lookup = new Lookup(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = keySelector(item); lookup.GetGrouping(key, create: true).Add(item); @@ -123,7 +123,7 @@ internal static async Task> CreateForJoinAsync(IAsyncEnum { var lookup = new Lookup(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = keySelector(item); if (key != null) @@ -356,7 +356,7 @@ internal static async Task> CreateAsync( var lookup = new LookupWithTask(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = await keySelector(item).ConfigureAwait(false); var group = lookup.GetGrouping(key, create: true); @@ -377,7 +377,7 @@ internal static async Task> CreateAsync( var lookup = new LookupWithTask(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = await keySelector(item, cancellationToken).ConfigureAwait(false); var group = lookup.GetGrouping(key, create: true); @@ -397,7 +397,7 @@ internal static async Task> CreateAsync(IAsyncEnu var lookup = new LookupWithTask(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = await keySelector(item).ConfigureAwait(false); lookup.GetGrouping(key, create: true).Add(item); @@ -414,7 +414,7 @@ internal static async Task> CreateAsync(IAsyncEnu var lookup = new LookupWithTask(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = await keySelector(item, cancellationToken).ConfigureAwait(false); lookup.GetGrouping(key, create: true).Add(item); @@ -428,7 +428,7 @@ internal static async Task> CreateForJoinAsync(IA { var lookup = new LookupWithTask(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = await keySelector(item).ConfigureAwait(false); if (key != null) @@ -445,7 +445,7 @@ internal static async Task> CreateForJoinAsync(IA { var lookup = new LookupWithTask(comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var item in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var key = await keySelector(item, cancellationToken).ConfigureAwait(false); if (key != null) diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/OfType.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/OfType.cs index 1407754e4d..1220ed56fc 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/OfType.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/OfType.cs @@ -28,7 +28,7 @@ public static IAsyncEnumerable OfType(this IAsyncEnumerable Core(CancellationToken cancellationToken) { - await foreach (var obj in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var obj in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (obj is TResult result) { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs index b1c5822584..c660988ee1 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs @@ -43,7 +43,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -110,7 +110,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -140,7 +140,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs index 74a5a8dc39..3df9eae4bc 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs @@ -59,7 +59,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -68,7 +68,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) var inner = selector(element, index); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return subElement; } @@ -93,7 +93,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -102,7 +102,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) var inner = await selector(element, index).ConfigureAwait(false); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return subElement; } @@ -128,7 +128,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -137,7 +137,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) var inner = await selector(element, index, cancellationToken).ConfigureAwait(false); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return subElement; } @@ -163,11 +163,11 @@ public static IAsyncEnumerable SelectMany Core(CancellationToken cancellationToken) { - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var inner = collectionSelector(element); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return resultSelector(element, subElement); } @@ -192,11 +192,11 @@ internal static IAsyncEnumerable SelectManyAwaitCore Core(CancellationToken cancellationToken) { - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var inner = await collectionSelector(element).ConfigureAwait(false); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return await resultSelector(element, subElement).ConfigureAwait(false); } @@ -222,11 +222,11 @@ internal static IAsyncEnumerable SelectManyAwaitWithCancellationCore Core(CancellationToken cancellationToken) { - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var inner = await collectionSelector(element, cancellationToken).ConfigureAwait(false); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return await resultSelector(element, subElement, cancellationToken).ConfigureAwait(false); } @@ -254,7 +254,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -263,7 +263,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) var inner = collectionSelector(element, index); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return resultSelector(element, subElement); } @@ -290,7 +290,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -299,7 +299,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) var inner = await collectionSelector(element, index).ConfigureAwait(false); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return await resultSelector(element, subElement).ConfigureAwait(false); } @@ -327,7 +327,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -336,7 +336,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) var inner = await collectionSelector(element, index, cancellationToken).ConfigureAwait(false); - await foreach (var subElement in AsyncEnumerableExtensions.WithCancellation(inner, cancellationToken).ConfigureAwait(false)) + await foreach (var subElement in inner.WithCancellation(cancellationToken).ConfigureAwait(false)) { yield return await resultSelector(element, subElement, cancellationToken).ConfigureAwait(false); } @@ -404,7 +404,7 @@ async ValueTask Core(CancellationToken _cancellationToken) { var count = 0; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var element in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { checked { @@ -429,7 +429,7 @@ public async ValueTask> ToListAsync(CancellationToken cancellation { var list = new List(); - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(_source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in _source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var items = _selector(element); @@ -543,7 +543,7 @@ async ValueTask Core(CancellationToken _cancellationToken) { var count = 0; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var element in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var items = await _selector(element).ConfigureAwait(false); @@ -570,7 +570,7 @@ public async ValueTask> ToListAsync(CancellationToken cancellation { var list = new List(); - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(_source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in _source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var items = await _selector(element).ConfigureAwait(false); @@ -685,7 +685,7 @@ async ValueTask Core(CancellationToken _cancellationToken) { var count = 0; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var element in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var items = await _selector(element, _cancellationToken).ConfigureAwait(false); @@ -712,7 +712,7 @@ public async ValueTask> ToListAsync(CancellationToken cancellation { var list = new List(); - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(_source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in _source.WithCancellation(cancellationToken).ConfigureAwait(false)) { var items = await _selector(element, cancellationToken).ConfigureAwait(false); diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Sum.Generated.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Sum.Generated.cs index 8d5f917ed2..214d2b8ec3 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Sum.Generated.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Sum.Generated.cs @@ -21,7 +21,7 @@ static async ValueTask Core(IAsyncEnumerable _source, CancellationToke { var sum = 0; - await foreach (int value in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (int value in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { checked { @@ -46,7 +46,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, CancellationTo { var sum = 0L; - await foreach (long value in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (long value in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { checked { @@ -152,7 +152,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Cancellation { var sum = 0.0f; - await foreach (float value in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (float value in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { sum += value; } @@ -255,7 +255,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Cancellati { var sum = 0.0; - await foreach (double value in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (double value in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { sum += value; } @@ -349,7 +349,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Cancella { var sum = 0m; - await foreach (decimal value in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (decimal value in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { sum += value; } @@ -443,7 +443,7 @@ static async ValueTask Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func Core(IAsyncEnumerable _source, Func; - await foreach (<#=o.type#> value in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (<#=o.type#> value in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { <# if (o.@checked) @@ -84,7 +84,7 @@ else { var sum = <#=o.zero#>; - await foreach (TSource item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (TSource item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var value = _selector(item); @@ -125,7 +125,7 @@ else { var sum = <#=o.zero#>; - await foreach (TSource item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (TSource item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var value = await _selector(item).ConfigureAwait(false); @@ -167,7 +167,7 @@ else { var sum = <#=o.zero#>; - await foreach (TSource item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (TSource item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var value = await _selector(item, _cancellationToken).ConfigureAwait(false); diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/TakeWhile.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/TakeWhile.cs index cb31144c20..ee8a9a07ee 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/TakeWhile.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/TakeWhile.cs @@ -23,7 +23,7 @@ public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable async IAsyncEnumerator Core(CancellationToken cancellationToken) { - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (!predicate(element)) { @@ -52,7 +52,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -84,7 +84,7 @@ internal static IAsyncEnumerable TakeWhileAwaitCore(this IAsyn async IAsyncEnumerator Core(CancellationToken cancellationToken) { - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (!await predicate(element).ConfigureAwait(false)) { @@ -112,7 +112,7 @@ internal static IAsyncEnumerable TakeWhileAwaitWithCancellationCore Core(CancellationToken cancellationToken) { - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { if (!await predicate(element, cancellationToken).ConfigureAwait(false)) { @@ -142,7 +142,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -177,7 +177,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToDictionary.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToDictionary.cs index 8e5bdb2a91..9003ec7434 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToDictionary.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToDictionary.cs @@ -26,7 +26,7 @@ static async ValueTask> Core(IAsyncEnumerable { var d = new Dictionary(_comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var key = _keySelector(item); @@ -53,7 +53,7 @@ static async ValueTask> Core(IAsyncEnumerable { var d = new Dictionary(_comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var key = await _keySelector(item).ConfigureAwait(false); @@ -81,7 +81,7 @@ static async ValueTask> Core(IAsyncEnumerable { var d = new Dictionary(_comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var key = await _keySelector(item, _cancellationToken).ConfigureAwait(false); @@ -111,7 +111,7 @@ static async ValueTask> Core(IAsyncEnumerable(_comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var key = _keySelector(item); var value = _elementSelector(item); @@ -141,7 +141,7 @@ static async ValueTask> Core(IAsyncEnumerable(_comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var key = await _keySelector(item).ConfigureAwait(false); var value = await _elementSelector(item).ConfigureAwait(false); @@ -172,7 +172,7 @@ static async ValueTask> Core(IAsyncEnumerable(_comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { var key = await _keySelector(item, _cancellationToken).ConfigureAwait(false); var value = await _elementSelector(item, _cancellationToken).ConfigureAwait(false); diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToHashSet.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToHashSet.cs index a6ec853195..009533a450 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToHashSet.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToHashSet.cs @@ -24,7 +24,7 @@ static async ValueTask> Core(IAsyncEnumerable _source, { var set = new HashSet(_comparer); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { set.Add(item); } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToList.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToList.cs index 77e5ebbc9c..7e5537e21f 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToList.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToList.cs @@ -24,7 +24,7 @@ static async ValueTask> Core(IAsyncEnumerable _source, Ca { var list = new List(); - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(_source, _cancellationToken).ConfigureAwait(false)) + await foreach (var item in _source.WithCancellation(_cancellationToken).ConfigureAwait(false)) { list.Add(item); } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Union.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Union.cs index cea2036dfe..338da0ed4e 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Union.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Union.cs @@ -162,7 +162,7 @@ private async Task> FillSetAsync(CancellationToken cancellationToke return set; } - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(enumerable, cancellationToken).ConfigureAwait(false)) + await foreach (var item in enumerable.WithCancellation(cancellationToken).ConfigureAwait(false)) { set.Add(item); } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Utilities.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Utilities.cs index 4e9c58f838..e26284561b 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Utilities.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Utilities.cs @@ -38,7 +38,7 @@ public static async ValueTask AddRangeAsync(this List list, IAsyncEnumerab } } - await foreach (var item in AsyncEnumerableExtensions.WithCancellation(collection, cancellationToken).ConfigureAwait(false)) + await foreach (var item in collection.WithCancellation(cancellationToken).ConfigureAwait(false)) { list.Add(item); } diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs index f329431be9..d4e057b754 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs @@ -41,7 +41,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -107,7 +107,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { @@ -140,7 +140,7 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) { var index = -1; - await foreach (var element in AsyncEnumerableExtensions.WithCancellation(source, cancellationToken).ConfigureAwait(false)) + await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false)) { checked { diff --git a/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/AsyncIteratorMethodBuilder.cs b/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/AsyncIteratorMethodBuilder.cs deleted file mode 100644 index 0d2c5d2053..0000000000 --- a/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/AsyncIteratorMethodBuilder.cs +++ /dev/null @@ -1,95 +0,0 @@ -#if !BCL_HAS_CONFIGUREAWAIT - -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace System.Runtime.CompilerServices -{ - /// Represents a builder for asynchronous iterators. - [StructLayout(LayoutKind.Auto)] - public struct AsyncIteratorMethodBuilder - { - // AsyncIteratorMethodBuilder is used by the language compiler as part of generating - // async iterators. For now, the implementation just wraps AsyncTaskMethodBuilder, as - // most of the logic is shared. However, in the future this could be changed and - // optimized. For example, we do need to allocate an object (once) to flow state like - // ExecutionContext, which AsyncTaskMethodBuilder handles, but it handles it by - // allocating a Task-derived object. We could optimize this further by removing - // the Task from the hierarchy, but in doing so we'd also lose a variety of optimizations - // related to it, so we'd need to replicate all of those optimizations (e.g. storing - // that box object directly into a Task's continuation field). - -#pragma warning disable IDE0044 // Add readonly modifier - private AsyncTaskMethodBuilder _methodBuilder; // mutable struct; do not make it readonly -#pragma warning restore IDE0044 // Add readonly modifier - - /// Creates an instance of the struct. - /// The initialized instance. - public static AsyncIteratorMethodBuilder Create() => -#if PROJECTN - // ProjectN's AsyncTaskMethodBuilder.Create() currently does additional debugger-related - // work, so we need to delegate to it. - new AsyncIteratorMethodBuilder() { _methodBuilder = AsyncTaskMethodBuilder.Create() }; -#else - // _methodBuilder should be initialized to AsyncTaskMethodBuilder.Create(), but on coreclr - // that Create() is a nop, so we can just return the default here. - default; -#endif - - /// Invokes on the state machine while guarding the . - /// The type of the state machine. - /// The state machine instance, passed by reference. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MoveNext(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine => -#if CORERT || !BCL_HAS_CONFIGUREAWAIT - _methodBuilder.Start(ref stateMachine); -#else - AsyncMethodBuilderCore.Start(ref stateMachine); -#endif - - /// Schedules the state machine to proceed to the next action when the specified awaiter completes. - /// The type of the awaiter. - /// The type of the state machine. - /// The awaiter. - /// The state machine. - public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) - where TAwaiter : INotifyCompletion - where TStateMachine : IAsyncStateMachine => - _methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine); - - /// Schedules the state machine to proceed to the next action when the specified awaiter completes. - /// The type of the awaiter. - /// The type of the state machine. - /// The awaiter. - /// The state machine. - public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) - where TAwaiter : ICriticalNotifyCompletion - where TStateMachine : IAsyncStateMachine => - _methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine); - - /// Marks iteration as being completed, whether successfully or otherwise. - public void Complete() => _methodBuilder.SetResult(); - - /// Gets an object that may be used to uniquely identify this builder to the debugger. - internal object ObjectIdForDebugger => typeof(AsyncTaskMethodBuilder) - .GetProperty("ObjectIdForDebugger", BindingFlags.Instance | BindingFlags.NonPublic) - .GetMethod.Invoke(_methodBuilder, null); - - - } -} - -#else -using System.Runtime.CompilerServices; - -[assembly: TypeForwardedTo(typeof(AsyncIteratorMethodBuilder))] - -#endif diff --git a/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/ConfiguredAsyncDisposable.cs b/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/ConfiguredAsyncDisposable.cs deleted file mode 100644 index 183dcc2e80..0000000000 --- a/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/ConfiguredAsyncDisposable.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if !HAS_ASYNCDISPOSABLE -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; - -namespace System.Runtime.CompilerServices -{ - /// Provides a type that can be used to configure how awaits on an are performed. - [StructLayout(LayoutKind.Auto)] - public readonly struct ConfiguredAsyncDisposable - { - private readonly IAsyncDisposable _source; - private readonly bool _continueOnCapturedContext; - - internal ConfiguredAsyncDisposable(IAsyncDisposable source, bool continueOnCapturedContext) - { - _source = source; - _continueOnCapturedContext = continueOnCapturedContext; - } - - public ConfiguredValueTaskAwaitable DisposeAsync() => - // as with other "configured" awaitable-related type in CompilerServices, we don't null check to defend against - // misuse like `default(ConfiguredAsyncDisposable).DisposeAsync()`, which will null ref by design. - _source.DisposeAsync().ConfigureAwait(_continueOnCapturedContext); - } -} -#else -using System.Runtime.CompilerServices; - -[assembly: TypeForwardedTo(typeof(ConfiguredAsyncDisposable))] -#endif diff --git a/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/ConfiguredCancelableAsyncEnumerable.cs b/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/ConfiguredCancelableAsyncEnumerable.cs deleted file mode 100644 index a97aec1da7..0000000000 --- a/Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/ConfiguredCancelableAsyncEnumerable.cs +++ /dev/null @@ -1,88 +0,0 @@ -#if !BCL_HAS_CONFIGUREAWAIT // https://github.com/dotnet/coreclr/pull/21939 - -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Threading; -using System.Threading.Tasks; - -namespace System.Runtime.CompilerServices -{ - /// Provides an awaitable async enumerable that enables cancelable iteration and configured awaits. - [StructLayout(LayoutKind.Auto)] - public readonly struct ConfiguredCancelableAsyncEnumerable - { - private readonly IAsyncEnumerable _enumerable; - private readonly CancellationToken _cancellationToken; - private readonly bool _continueOnCapturedContext; - - internal ConfiguredCancelableAsyncEnumerable(IAsyncEnumerable enumerable, bool continueOnCapturedContext, CancellationToken cancellationToken) - { - _enumerable = enumerable; - _continueOnCapturedContext = continueOnCapturedContext; - _cancellationToken = cancellationToken; - } - - /// Configures how awaits on the tasks returned from an async iteration will be performed. - /// Whether to capture and marshal back to the current context. - /// The configured enumerable. - /// This will replace any previous value set by for this iteration. - public ConfiguredCancelableAsyncEnumerable ConfigureAwait(bool continueOnCapturedContext) => - new ConfiguredCancelableAsyncEnumerable(_enumerable, continueOnCapturedContext, _cancellationToken); - - /// Sets the to be passed to when iterating. - /// The to use. - /// The configured enumerable. - /// This will replace any previous set by for this iteration. - public ConfiguredCancelableAsyncEnumerable WithCancellation(CancellationToken cancellationToken) => - new ConfiguredCancelableAsyncEnumerable(_enumerable, _continueOnCapturedContext, cancellationToken); - - public Enumerator GetAsyncEnumerator() => - // as with other "configured" awaitable-related type in CompilerServices, we don't null check to defend against - // misuse like `default(ConfiguredCancelableAsyncEnumerable).GetAsyncEnumerator()`, which will null ref by design. - new Enumerator(_enumerable.GetAsyncEnumerator(_cancellationToken), _continueOnCapturedContext); - - /// Provides an awaitable async enumerator that enables cancelable iteration and configured awaits. - [StructLayout(LayoutKind.Auto)] - public readonly struct Enumerator - { - private readonly IAsyncEnumerator _enumerator; - private readonly bool _continueOnCapturedContext; - - internal Enumerator(IAsyncEnumerator enumerator, bool continueOnCapturedContext) - { - _enumerator = enumerator; - _continueOnCapturedContext = continueOnCapturedContext; - } - - /// Advances the enumerator asynchronously to the next element of the collection. - /// - /// A that will complete with a result of true - /// if the enumerator was successfully advanced to the next element, or false if the enumerator has - /// passed the end of the collection. - /// - public ConfiguredValueTaskAwaitable MoveNextAsync() => - _enumerator.MoveNextAsync().ConfigureAwait(_continueOnCapturedContext); - - /// Gets the element in the collection at the current position of the enumerator. - public T Current => _enumerator.Current; - - /// - /// Performs application-defined tasks associated with freeing, releasing, or - /// resetting unmanaged resources asynchronously. - /// - public ConfiguredValueTaskAwaitable DisposeAsync() => - _enumerator.DisposeAsync().ConfigureAwait(_continueOnCapturedContext); - } - } -} - -#else -using System.Runtime.CompilerServices; - -[assembly: TypeForwardedTo(typeof(ConfiguredCancelableAsyncEnumerable<>))] - -#endif diff --git a/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/AsyncEnumerableExt.cs b/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/AsyncEnumerableExt.cs index 52380f4dc8..e6154379c7 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/AsyncEnumerableExt.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/AsyncEnumerableExt.cs @@ -11,7 +11,7 @@ internal static class AsyncEnumerableExt { public static ConfiguredCancelableAsyncEnumerable.Enumerator GetConfiguredAsyncEnumerator(this IAsyncEnumerable enumerable, CancellationToken cancellationToken, bool continueOnCapturedContext) { - return AsyncEnumerableExtensions.ConfigureAwait(enumerable, continueOnCapturedContext).WithCancellation(cancellationToken).GetAsyncEnumerator(); + return enumerable.ConfigureAwait(continueOnCapturedContext).WithCancellation(cancellationToken).GetAsyncEnumerator(); } } } diff --git a/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/AsyncEnumerableExtensions.cs b/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/AsyncEnumerableExtensions.cs deleted file mode 100644 index d3595bfe44..0000000000 --- a/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/AsyncEnumerableExtensions.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace System.Threading.Tasks -{ - - // This type is only public for ref assms < .NET Standard 2.1 and implementations -#if !BCL_HAS_CONFIGUREAWAIT || !REFERENCE_ASSEMBLY - public -#else - internal -#endif - static class AsyncEnumerableExtensions - { -#if !BCL_HAS_CONFIGUREAWAIT // https://github.com/dotnet/coreclr/pull/21939 - - /// Configures how awaits on the tasks returned from an async disposable will be performed. - /// The source async disposable. - /// Whether to capture and marshal back to the current context. - /// The configured async disposable. - public static ConfiguredAsyncDisposable ConfigureAwait(this IAsyncDisposable source, bool continueOnCapturedContext) => - new ConfiguredAsyncDisposable(source, continueOnCapturedContext); - - /// Configures how awaits on the tasks returned from an async iteration will be performed. - /// The type of the objects being iterated. - /// The source enumerable being iterated. - /// Whether to capture and marshal back to the current context. - /// The configured enumerable. - public static ConfiguredCancelableAsyncEnumerable ConfigureAwait( - this IAsyncEnumerable source, bool continueOnCapturedContext) => - new ConfiguredCancelableAsyncEnumerable(source, continueOnCapturedContext, cancellationToken: default); - - /// Sets the to be passed to when iterating. - /// The type of the objects being iterated. - /// The source enumerable being iterated. - /// The to use. - /// The configured enumerable. - public static ConfiguredCancelableAsyncEnumerable WithCancellation( - this IAsyncEnumerable source, CancellationToken cancellationToken) => - new ConfiguredCancelableAsyncEnumerable(source, continueOnCapturedContext: true, cancellationToken); - - -#else - // we need to carry an impl that delegates to the BCL version of these in the lib - // They won't be in the ref - - /// Configures how awaits on the tasks returned from an async disposable will be performed. - /// The source async disposable. - /// Whether to capture and marshal back to the current context. - /// The configured async disposable. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ConfiguredAsyncDisposable ConfigureAwait(this IAsyncDisposable source, bool continueOnCapturedContext) => - TaskExtensions.ConfigureAwait(source, continueOnCapturedContext); - - /// Configures how awaits on the tasks returned from an async iteration will be performed. - /// The type of the objects being iterated. - /// The source enumerable being iterated. - /// Whether to capture and marshal back to the current context. - /// The configured enumerable. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ConfiguredCancelableAsyncEnumerable ConfigureAwait( - this IAsyncEnumerable source, bool continueOnCapturedContext) => TaskExtensions.ConfigureAwait(source, continueOnCapturedContext); - - /// Sets the to be passed to when iterating. - /// The type of the objects being iterated. - /// The source enumerable being iterated. - /// The to use. - /// The configured enumerable. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ConfiguredCancelableAsyncEnumerable WithCancellation( - this IAsyncEnumerable source, CancellationToken cancellationToken) => TaskExtensions.WithCancellation(source, cancellationToken); -#endif - } -} diff --git a/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs b/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs deleted file mode 100644 index 602516bdd4..0000000000 --- a/Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs +++ /dev/null @@ -1,292 +0,0 @@ -#if !BCL_HAS_CONFIGUREAWAIT -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Runtime.ExceptionServices; -using System.Runtime.InteropServices; - -namespace System.Threading.Tasks.Sources -{ - /// Provides the core logic for implementing a manual-reset or . - /// - [StructLayout(LayoutKind.Auto)] - public struct ManualResetValueTaskSourceCore - { - /// - /// The callback to invoke when the operation completes if was called before the operation completed, - /// or if the operation completed before a callback was supplied, - /// or null if a callback hasn't yet been provided and the operation hasn't yet completed. - /// - private Action _continuation; - /// State to pass to . - private object _continuationState; - /// to flow to the callback, or null if no flowing is required. - private ExecutionContext _executionContext; - /// - /// A "captured" or with which to invoke the callback, - /// or null if no special context is required. - /// - private object _capturedContext; - /// Whether the current operation has completed. - private bool _completed; - /// The result with which the operation succeeded, or the default value if it hasn't yet completed or failed. - private TResult _result; - /// The exception with which the operation failed, or null if it hasn't yet completed or completed successfully. - private ExceptionDispatchInfo _error; - /// The current version of this value, used to help prevent misuse. - private short _version; - - /// Gets or sets whether to force continuations to run asynchronously. - /// Continuations may run asynchronously if this is false, but they'll never run synchronously if this is true. - public bool RunContinuationsAsynchronously { get; set; } - - /// Resets to prepare for the next operation. - public void Reset() - { - // Reset/update state for the next use/await of this instance. - _version++; - _completed = false; - _result = default; - _error = null; - _executionContext = null; - _capturedContext = null; - _continuation = null; - _continuationState = null; - } - - /// Completes with a successful result. - /// The result. - public void SetResult(TResult result) - { - _result = result; - SignalCompletion(); - } - - /// Complets with an error. - /// - public void SetException(Exception error) - { - _error = ExceptionDispatchInfo.Capture(error); - SignalCompletion(); - } - - /// Gets the operation version. - public short Version => _version; - - /// Gets the status of the operation. - /// Opaque value that was provided to the 's constructor. - public ValueTaskSourceStatus GetStatus(short token) - { - ValidateToken(token); - return - _continuation == null || !_completed ? ValueTaskSourceStatus.Pending : - _error == null ? ValueTaskSourceStatus.Succeeded : - _error.SourceException is OperationCanceledException ? ValueTaskSourceStatus.Canceled : - ValueTaskSourceStatus.Faulted; - } - - /// Gets the result of the operation. - /// Opaque value that was provided to the 's constructor. - [StackTraceHidden] - public TResult GetResult(short token) - { - ValidateToken(token); - if (!_completed) - { - ManualResetValueTaskSourceCoreShared.ThrowInvalidOperationException(); - } - - _error?.Throw(); - return _result; - } - - /// Schedules the continuation action for this operation. - /// The continuation to invoke when the operation has completed. - /// The state object to pass to when it's invoked. - /// Opaque value that was provided to the 's constructor. - /// The flags describing the behavior of the continuation. - public void OnCompleted(Action continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags) - { - if (continuation == null) - { - throw new ArgumentNullException(nameof(continuation)); - } - ValidateToken(token); - - if ((flags & ValueTaskSourceOnCompletedFlags.FlowExecutionContext) != 0) - { - _executionContext = ExecutionContext.Capture(); - } - - if ((flags & ValueTaskSourceOnCompletedFlags.UseSchedulingContext) != 0) - { - SynchronizationContext sc = SynchronizationContext.Current; - if (sc != null && sc.GetType() != typeof(SynchronizationContext)) - { - _capturedContext = sc; - } - else - { - TaskScheduler ts = TaskScheduler.Current; - if (ts != TaskScheduler.Default) - { - _capturedContext = ts; - } - } - } - - // We need to set the continuation state before we swap in the delegate, so that - // if there's a race between this and SetResult/Exception and SetResult/Exception - // sees the _continuation as non-null, it'll be able to invoke it with the state - // stored here. However, this also means that if this is used incorrectly (e.g. - // awaited twice concurrently), _continuationState might get erroneously overwritten. - // To minimize the chances of that, we check preemptively whether _continuation - // is already set to something other than the completion sentinel. - - object oldContinuation = _continuation; - if (oldContinuation == null) - { - _continuationState = state; - oldContinuation = Interlocked.CompareExchange(ref _continuation, continuation, null); - } - - if (oldContinuation != null) - { - // Operation already completed, so we need to queue the supplied callback. - if (!ReferenceEquals(oldContinuation, ManualResetValueTaskSourceCoreShared.s_sentinel)) - { - ManualResetValueTaskSourceCoreShared.ThrowInvalidOperationException(); - } - - switch (_capturedContext) - { - case null: - if (_executionContext != null) - { - ThreadPool.QueueUserWorkItem(s => continuation(s), state); - } - else - { - ThreadPool.UnsafeQueueUserWorkItem(s => continuation(s), state); - } - break; - - case SynchronizationContext sc: - sc.Post(s => - { - var tuple = (Tuple, object>)s; - tuple.Item1(tuple.Item2); - }, Tuple.Create(continuation, state)); - break; - - case TaskScheduler ts: - Task.Factory.StartNew(continuation, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, ts); - break; - } - } - } - - /// Ensures that the specified token matches the current version. - /// The token supplied by . - private void ValidateToken(short token) - { - if (token != _version) - { - ManualResetValueTaskSourceCoreShared.ThrowInvalidOperationException(); - } - } - - /// Signals that that the operation has completed. Invoked after the result or error has been set. - private void SignalCompletion() - { - if (_completed) - { - ManualResetValueTaskSourceCoreShared.ThrowInvalidOperationException(); - } - _completed = true; - - if (_continuation != null || Interlocked.CompareExchange(ref _continuation, ManualResetValueTaskSourceCoreShared.s_sentinel, null) != null) - { - if (_executionContext != null) - { - ExecutionContext.Run(_executionContext, - s => ((ManualResetValueTaskSourceCore)s).InvokeContinuation(), - this); - - //ExecutionContext.RunInternal( - // _executionContext, - // (ref ManualResetValueTaskSourceCore s) => s.InvokeContinuation(), - // ref this); - } - else - { - InvokeContinuation(); - } - } - } - - /// - /// Invokes the continuation with the appropriate captured context / scheduler. - /// This assumes that if is not null we're already - /// running within that . - /// - private void InvokeContinuation() - { - switch (_capturedContext) - { - case null: - if (RunContinuationsAsynchronously) - { - var c = _continuation; - if (_executionContext != null) - { - ThreadPool.QueueUserWorkItem(s => c(s), _continuationState); - } - else - { - ThreadPool.UnsafeQueueUserWorkItem(s => c(s), _continuationState); - } - } - else - { - _continuation(_continuationState); - } - break; - - case SynchronizationContext sc: - sc.Post(s => - { - var state = (Tuple, object>)s; - state.Item1(state.Item2); - }, Tuple.Create(_continuation, _continuationState)); - break; - - case TaskScheduler ts: - Task.Factory.StartNew(_continuation, _continuationState, CancellationToken.None, TaskCreationOptions.DenyChildAttach, ts); - break; - } - } - } - - internal static class ManualResetValueTaskSourceCoreShared // separated out of generic to avoid unnecessary duplication - { - [StackTraceHidden] - internal static void ThrowInvalidOperationException() => throw new InvalidOperationException(); - - internal static readonly Action s_sentinel = CompletionSentinel; - private static void CompletionSentinel(object _) // named method to aid debugging - { - Debug.Fail("The sentinel delegate should never be invoked."); - ThrowInvalidOperationException(); - } - } -} - -#else - -using System.Runtime.CompilerServices; - -[assembly: TypeForwardedTo(typeof(System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<>))] -#endif diff --git a/Ix.NET/Source/global.json b/Ix.NET/Source/global.json index 89d5a56cd8..6096755662 100644 --- a/Ix.NET/Source/global.json +++ b/Ix.NET/Source/global.json @@ -1,8 +1,8 @@ { "sdk": { - "version": "3.0.100-preview4" + "version": "3.0.100-preview" }, "msbuild-sdks": { - "MSBuild.Sdk.Extras": "2.0.0-preview.21" + "MSBuild.Sdk.Extras": "2.0.24" } } diff --git a/Ix.NET/Source/refs/System.Linq.Async.Ref/System.Linq.Async.Ref.csproj b/Ix.NET/Source/refs/System.Linq.Async.Ref/System.Linq.Async.Ref.csproj index 34058f451f..9dc16557bc 100644 --- a/Ix.NET/Source/refs/System.Linq.Async.Ref/System.Linq.Async.Ref.csproj +++ b/Ix.NET/Source/refs/System.Linq.Async.Ref/System.Linq.Async.Ref.csproj @@ -4,13 +4,12 @@ LINQ Standard Query Operators used to express queries over asynchronous enumerable sequences. System.Linq.Async Microsoft - net45;netstandard2.0;netstandard2.1;netcoreapp3.0 + net461;netstandard2.0;netstandard2.1;netcoreapp3.0 Enumerable;Asynchronous;LINQ - + diff --git a/azure-pipelines.ix.yml b/azure-pipelines.ix.yml index e7a0266f44..b27baef5e2 100644 --- a/azure-pipelines.ix.yml +++ b/azure-pipelines.ix.yml @@ -26,11 +26,12 @@ pool: variables: BuildConfiguration: Release + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true steps: - task: DotNetCoreInstaller@0 inputs: - version: '3.0.100-preview4-011033' + version: '3.0.100-preview5-011568' - task: DotNetCoreCLI@2 inputs: