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

Use Microsoft.Bcl.AsyncInterfaces

Oren Novotny пре 6 година
родитељ
комит
e690374fd7

+ 2 - 2
Ix.NET/Source/Directory.build.props

@@ -16,8 +16,8 @@
     <DebugType Condition="'$(Configuration)' != 'Debug'">embedded</DebugType>
     <EmbedUntrackedSources>true</EmbedUntrackedSources>
     <PublishRepositoryUrl>true</PublishRepositoryUrl>
-    <!-- While in beta, we need to set 8.0 manually (rather than latest). -->
-    <LangVersion>8.0</LangVersion>
+    <!-- While in beta, we need to set preview for 8.0 manually (rather than latest). -->
+    <LangVersion>preview</LangVersion>
   </PropertyGroup>
 
   <ItemGroup>

+ 1 - 6
Ix.NET/Source/Directory.build.targets

@@ -10,7 +10,7 @@
   <PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
     <DefineConstants>$(DefineConstants);NO_ARRAY_EMPTY;NO_TASK_FROMEXCEPTION</DefineConstants>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
+  <PropertyGroup Condition="'$(TargetFramework)' == 'net46' or '$(TargetFramework)' == 'net461'">
     <DefineConstants>$(DefineConstants);USE_ASYNC_ITERATOR</DefineConstants>
   </PropertyGroup>
   <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0' or '$(TargetFramework)' == 'netstandard2.1'">
@@ -21,11 +21,6 @@
     <Product>$(AssemblyName) ($(TargetFramework))</Product>
   </PropertyGroup>
   
-  <ItemGroup>
-    <!-- Workaround https://github.com/dotnet/sdk/issues/2976 -->
-    <PackageReference Update="Microsoft.NETCore.Platforms" PrivateAssets="All" />
-  </ItemGroup>
-  
   <PropertyGroup Condition="'$(IsTestProject)' == 'true'">
     <UseSourceLink>true</UseSourceLink>
     <CoverletOutputFormat>cobertura</CoverletOutputFormat>

+ 11 - 0
Ix.NET/Source/NuGet.config

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <packageSources>    
+    <add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
+    <add key="dotnet-windowsdesktop" value="https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json" />
+    <add key="aspnet-aspnetcore" value="https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json" />
+    <add key="aspnet-aspnetcore-tooling" value="https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json" />
+    <add key="aspnet-entityframeworkcore" value="https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json" />
+    <add key="aspnet-extensions" value="https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json" />
+  </packageSources>
+</configuration>

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

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <Description>Interactive Extensions Async Library used to express queries over asynchronous enumerable sequences.</Description>
     <AssemblyTitle>Interactive Extensions - Async Library</AssemblyTitle>
-    <TargetFrameworks>net45;net46;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
+    <TargetFrameworks>net461;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
     <PackageTags>Ix;Interactive;Extensions;Enumerable;Asynchronous</PackageTags>
   </PropertyGroup>
 

+ 2 - 6
Ix.NET/Source/System.Linq.Async/System.Linq.Async.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="MSBuild.Sdk.Extras">
 
   <PropertyGroup>
-    <TargetFrameworks>net45;net46;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
+    <TargetFrameworks>net461;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
   </PropertyGroup>
 
   <ItemGroup>
@@ -23,7 +23,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Condition="'$(TargetFramework)' != 'netcoreapp3.0' and '$(TargetFramework)' != 'netstandard2.1' " Include="System.Threading.Tasks.Extensions" Version="4.5.2" />
+    <PackageReference Condition="'$(TargetFramework)' != 'netcoreapp3.0' and '$(TargetFramework)' != 'netstandard2.1' " Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0-preview6.19252.4" />
     <ReferenceAssemblyProjectReference Include="..\refs\System.Linq.Async.Ref\System.Linq.Async.Ref.csproj" />
   </ItemGroup>
 
@@ -87,8 +87,4 @@
     </None>
   </ItemGroup>
 
-  <ItemGroup>
-    <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
-  </ItemGroup>
-
 </Project>

+ 0 - 34
Ix.NET/Source/System.Linq.Async/System/Collections/Generic/IAsyncEnumerable.cs

@@ -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
-{
-    /// <summary>
-    /// Asynchronous version of the <see cref="IEnumerable{T}"/> interface, allowing elements of the enumerable sequence to be retrieved asynchronously.
-    /// </summary>
-    /// <typeparam name="T">Element type.</typeparam>
-    public interface IAsyncEnumerable<out T>
-    {
-        /// <summary>
-        /// Gets an asynchronous enumerator over the sequence.
-        /// </summary>
-        /// <param name="cancellationToken">Cancellation token used to cancel the enumeration.</param>
-        /// <returns>Enumerator for asynchronous enumeration over the sequence.</returns>
-        IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default);
-    }
-}
-
-#else
-using System.Runtime.CompilerServices;
-
-[assembly: TypeForwardedTo(typeof(System.Collections.Generic.IAsyncEnumerable<>))]
-
-#endif

+ 0 - 40
Ix.NET/Source/System.Linq.Async/System/Collections/Generic/IAsyncEnumerator.cs

@@ -1,40 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the Apache 2.0 License.
-// See the LICENSE file in the project root for more information. 
-
-// 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
-{
-    /// <summary>
-    /// Asynchronous version of the <see cref="IEnumerator{T}"/> interface, allowing elements to be retrieved asynchronously.
-    /// </summary>
-    /// <typeparam name="T">Element type.</typeparam>
-    public interface IAsyncEnumerator<out T> : IAsyncDisposable
-    {
-        /// <summary>
-        /// Gets the current element in the iteration.
-        /// </summary>
-        T Current { get; }
-
-        /// <summary>
-        /// Advances the enumerator to the next element in the sequence, returning the result asynchronously.
-        /// </summary>
-        /// <returns>
-        /// Task containing the result of the operation: true if the enumerator was successfully advanced
-        /// to the next element; false if the enumerator has passed the end of the sequence.
-        /// </returns>
-        ValueTask<bool> MoveNextAsync();
-    }
-}
-
-#else
-using System.Runtime.CompilerServices;
-
-[assembly: TypeForwardedTo(typeof(System.Collections.Generic.IAsyncEnumerator<>))]
-#endif

+ 0 - 24
Ix.NET/Source/System.Linq.Async/System/IAsyncDisposable.cs

@@ -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

+ 0 - 95
Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/AsyncIteratorMethodBuilder.cs

@@ -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
-{
-    /// <summary>Represents a builder for asynchronous iterators.</summary>
-    [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
-
-        /// <summary>Creates an instance of the <see cref="AsyncIteratorMethodBuilder"/> struct.</summary>
-        /// <returns>The initialized instance.</returns>
-        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
-
-        /// <summary>Invokes <see cref="IAsyncStateMachine.MoveNext"/> on the state machine while guarding the <see cref="ExecutionContext"/>.</summary>
-        /// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
-        /// <param name="stateMachine">The state machine instance, passed by reference.</param>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public void MoveNext<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine =>
-#if CORERT || !BCL_HAS_CONFIGUREAWAIT
-            _methodBuilder.Start(ref stateMachine);
-#else
-            AsyncMethodBuilderCore.Start(ref stateMachine);
-#endif
-
-        /// <summary>Schedules the state machine to proceed to the next action when the specified awaiter completes.</summary>
-        /// <typeparam name="TAwaiter">The type of the awaiter.</typeparam>
-        /// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
-        /// <param name="awaiter">The awaiter.</param>
-        /// <param name="stateMachine">The state machine.</param>
-        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
-            where TAwaiter : INotifyCompletion
-            where TStateMachine : IAsyncStateMachine =>
-            _methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine);
-
-        /// <summary>Schedules the state machine to proceed to the next action when the specified awaiter completes.</summary>
-        /// <typeparam name="TAwaiter">The type of the awaiter.</typeparam>
-        /// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
-        /// <param name="awaiter">The awaiter.</param>
-        /// <param name="stateMachine">The state machine.</param>
-        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
-            where TAwaiter : ICriticalNotifyCompletion
-            where TStateMachine : IAsyncStateMachine =>
-            _methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
-
-        /// <summary>Marks iteration as being completed, whether successfully or otherwise.</summary>
-        public void Complete() => _methodBuilder.SetResult();
-
-        /// <summary>Gets an object that may be used to uniquely identify this builder to the debugger.</summary>
-        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

+ 0 - 33
Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/ConfiguredAsyncDisposable.cs

@@ -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
-{
-    /// <summary>Provides a type that can be used to configure how awaits on an <see cref="IAsyncDisposable"/> are performed.</summary>
-    [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

+ 0 - 88
Ix.NET/Source/System.Linq.Async/System/Runtime/CompilerServices/ConfiguredCancelableAsyncEnumerable.cs

@@ -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
-{
-    /// <summary>Provides an awaitable async enumerable that enables cancelable iteration and configured awaits.</summary>
-    [StructLayout(LayoutKind.Auto)]
-    public readonly struct ConfiguredCancelableAsyncEnumerable<T>
-    {
-        private readonly IAsyncEnumerable<T> _enumerable;
-        private readonly CancellationToken _cancellationToken;
-        private readonly bool _continueOnCapturedContext;
-
-        internal ConfiguredCancelableAsyncEnumerable(IAsyncEnumerable<T> enumerable, bool continueOnCapturedContext, CancellationToken cancellationToken)
-        {
-            _enumerable = enumerable;
-            _continueOnCapturedContext = continueOnCapturedContext;
-            _cancellationToken = cancellationToken;
-        }
-
-        /// <summary>Configures how awaits on the tasks returned from an async iteration will be performed.</summary>
-        /// <param name="continueOnCapturedContext">Whether to capture and marshal back to the current context.</param>
-        /// <returns>The configured enumerable.</returns>
-        /// <remarks>This will replace any previous value set by <see cref="ConfigureAwait(bool)"/> for this iteration.</remarks>
-        public ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait(bool continueOnCapturedContext) =>
-            new ConfiguredCancelableAsyncEnumerable<T>(_enumerable, continueOnCapturedContext, _cancellationToken);
-
-        /// <summary>Sets the <see cref="CancellationToken"/> to be passed to <see cref="IAsyncEnumerable{T}.GetAsyncEnumerator(CancellationToken)"/> when iterating.</summary>
-        /// <param name="cancellationToken">The <see cref="CancellationToken"/> to use.</param>
-        /// <returns>The configured enumerable.</returns>
-        /// <remarks>This will replace any previous <see cref="CancellationToken"/> set by <see cref="WithCancellation(CancellationToken)"/> for this iteration.</remarks>
-        public ConfiguredCancelableAsyncEnumerable<T> WithCancellation(CancellationToken cancellationToken) =>
-            new ConfiguredCancelableAsyncEnumerable<T>(_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<T>).GetAsyncEnumerator()`, which will null ref by design.
-            new Enumerator(_enumerable.GetAsyncEnumerator(_cancellationToken), _continueOnCapturedContext);
-
-        /// <summary>Provides an awaitable async enumerator that enables cancelable iteration and configured awaits.</summary>
-        [StructLayout(LayoutKind.Auto)]
-        public readonly struct Enumerator
-        {
-            private readonly IAsyncEnumerator<T> _enumerator;
-            private readonly bool _continueOnCapturedContext;
-
-            internal Enumerator(IAsyncEnumerator<T> enumerator, bool continueOnCapturedContext)
-            {
-                _enumerator = enumerator;
-                _continueOnCapturedContext = continueOnCapturedContext;
-            }
-
-            /// <summary>Advances the enumerator asynchronously to the next element of the collection.</summary>
-            /// <returns>
-            /// A <see cref="ConfiguredValueTaskAwaitable{Boolean}"/> that will complete with a result of <c>true</c>
-            /// if the enumerator was successfully advanced to the next element, or <c>false</c> if the enumerator has
-            /// passed the end of the collection.
-            /// </returns>
-            public ConfiguredValueTaskAwaitable<bool> MoveNextAsync() =>
-                _enumerator.MoveNextAsync().ConfigureAwait(_continueOnCapturedContext);
-
-            /// <summary>Gets the element in the collection at the current position of the enumerator.</summary>
-            public T Current => _enumerator.Current;
-
-            /// <summary>
-            /// Performs application-defined tasks associated with freeing, releasing, or
-            /// resetting unmanaged resources asynchronously.
-            /// </summary>
-            public ConfiguredValueTaskAwaitable DisposeAsync() =>
-                _enumerator.DisposeAsync().ConfigureAwait(_continueOnCapturedContext);
-        }
-    }
-}
-
-#else
-using System.Runtime.CompilerServices;
-
-[assembly: TypeForwardedTo(typeof(ConfiguredCancelableAsyncEnumerable<>))]
-
-#endif

+ 0 - 292
Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs

@@ -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
-{
-    /// <summary>Provides the core logic for implementing a manual-reset <see cref="IValueTaskSource"/> or <see cref="IValueTaskSource{TResult}"/>.</summary>
-    /// <typeparam name="TResult"></typeparam>
-    [StructLayout(LayoutKind.Auto)]
-    public struct ManualResetValueTaskSourceCore<TResult>
-    {
-        /// <summary>
-        /// The callback to invoke when the operation completes if <see cref="OnCompleted"/> was called before the operation completed,
-        /// or <see cref="ManualResetValueTaskSourceCoreShared.s_sentinel"/> 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.
-        /// </summary>
-        private Action<object> _continuation;
-        /// <summary>State to pass to <see cref="_continuation"/>.</summary>
-        private object _continuationState;
-        /// <summary><see cref="ExecutionContext"/> to flow to the callback, or null if no flowing is required.</summary>
-        private ExecutionContext _executionContext;
-        /// <summary>
-        /// A "captured" <see cref="SynchronizationContext"/> or <see cref="TaskScheduler"/> with which to invoke the callback,
-        /// or null if no special context is required.
-        /// </summary>
-        private object _capturedContext;
-        /// <summary>Whether the current operation has completed.</summary>
-        private bool _completed;
-        /// <summary>The result with which the operation succeeded, or the default value if it hasn't yet completed or failed.</summary>
-        private TResult _result;
-        /// <summary>The exception with which the operation failed, or null if it hasn't yet completed or completed successfully.</summary>
-        private ExceptionDispatchInfo _error;
-        /// <summary>The current version of this value, used to help prevent misuse.</summary>
-        private short _version;
-
-        /// <summary>Gets or sets whether to force continuations to run asynchronously.</summary>
-        /// <remarks>Continuations may run asynchronously if this is false, but they'll never run synchronously if this is true.</remarks>
-        public bool RunContinuationsAsynchronously { get; set; }
-
-        /// <summary>Resets to prepare for the next operation.</summary>
-        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;
-        }
-
-        /// <summary>Completes with a successful result.</summary>
-        /// <param name="result">The result.</param>
-        public void SetResult(TResult result)
-        {
-            _result = result;
-            SignalCompletion();
-        }
-
-        /// <summary>Complets with an error.</summary>
-        /// <param name="error"></param>
-        public void SetException(Exception error)
-        {
-            _error = ExceptionDispatchInfo.Capture(error);
-            SignalCompletion();
-        }
-
-        /// <summary>Gets the operation version.</summary>
-        public short Version => _version;
-
-        /// <summary>Gets the status of the operation.</summary>
-        /// <param name="token">Opaque value that was provided to the <see cref="ValueTask"/>'s constructor.</param>
-        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;
-        }
-
-        /// <summary>Gets the result of the operation.</summary>
-        /// <param name="token">Opaque value that was provided to the <see cref="ValueTask"/>'s constructor.</param>
-        [StackTraceHidden]
-        public TResult GetResult(short token)
-        {
-            ValidateToken(token);
-            if (!_completed)
-            {
-                ManualResetValueTaskSourceCoreShared.ThrowInvalidOperationException();
-            }
-
-            _error?.Throw();
-            return _result;
-        }
-
-        /// <summary>Schedules the continuation action for this operation.</summary>
-        /// <param name="continuation">The continuation to invoke when the operation has completed.</param>
-        /// <param name="state">The state object to pass to <paramref name="continuation"/> when it's invoked.</param>
-        /// <param name="token">Opaque value that was provided to the <see cref="ValueTask"/>'s constructor.</param>
-        /// <param name="flags">The flags describing the behavior of the continuation.</param>
-        public void OnCompleted(Action<object> 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<Action<object>, 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;
-                }
-            }
-        }
-
-        /// <summary>Ensures that the specified token matches the current version.</summary>
-        /// <param name="token">The token supplied by <see cref="ValueTask"/>.</param>
-        private void ValidateToken(short token)
-        {
-            if (token != _version)
-            {
-                ManualResetValueTaskSourceCoreShared.ThrowInvalidOperationException();
-            }
-        }
-
-        /// <summary>Signals that that the operation has completed.  Invoked after the result or error has been set.</summary>
-        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<TResult>)s).InvokeContinuation(),
-                        this);
-
-                    //ExecutionContext.RunInternal(
-                    //    _executionContext,
-                    //    (ref ManualResetValueTaskSourceCore<TResult> s) => s.InvokeContinuation(),
-                    //    ref this);
-                }
-                else
-                {
-                    InvokeContinuation();
-                }
-            }
-        }
-
-        /// <summary>
-        /// Invokes the continuation with the appropriate captured context / scheduler.
-        /// This assumes that if <see cref="_executionContext"/> is not null we're already
-        /// running within that <see cref="ExecutionContext"/>.
-        /// </summary>
-        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<Action<object>, 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<object> 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

+ 2 - 2
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"
   }
 }

+ 2 - 2
Ix.NET/Source/refs/System.Linq.Async.Ref/System.Linq.Async.Ref.csproj

@@ -4,13 +4,13 @@
     <Description>LINQ Standard Query Operators used to express queries over asynchronous enumerable sequences.</Description>
     <AssemblyTitle>System.Linq.Async</AssemblyTitle>
     <Authors>Microsoft</Authors>
-    <TargetFrameworks>net45;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
+    <TargetFrameworks>net461;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
     <PackageTags>Enumerable;Asynchronous;LINQ</PackageTags>
   </PropertyGroup>
 
   <ItemGroup>
     <PackageReference Condition="'$(TargetFramework)' != 'netcoreapp3.0' and '$(TargetFramework)' != 'netstandard2.1' "
-                      Include="System.Threading.Tasks.Extensions" Version="4.5.2" />
+                      Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0-preview6.19252.4" />
   </ItemGroup>
 
   <ItemGroup>