theraot/Theraot

IAsyncEnumerable<T>et.al.

Closed this issue · 3 comments

My attempt to port these has been a mess. I was trying to port from .NET Core 3.0

It is available in .NET Core 2.0 and .NET Standard 2.0 via Microsoft.Bcl.AsyncInterfaces. I should try taking it from there instead. Soon-ish. Nope, I gotta figure it out.

Ok, this is the mess:

IAsyncDisposable declares ValueTask DisposeAsync();

On one hand, ValueTask is available down to .NET 4.5 via System.Threading.Tasks.Extensions, I have provided it for .NET 4.0
On the other, IAsyncDisposable is available down to .NET 4.7... and because I have provided ValueTask for .NET 4.0 but not .NET 4.5 and .NET 4.6... I cannot implement IAsyncDisposable on .NET 4.5 and .NET 4.6... unless I add a dependency on System.Threading.Tasks.Extensions.

Addendum: simimal arrangements are needed for .NET Core and Standard.

There is a caveat with my implementation of ManualResetValueTaskSourceCore. In .NET Standard 1.0. 1.1 and 1.2 there is no ExecutionContext. As a result ManualResetValueTaskSourceCore will ignore ValueTaskSourceOnCompletedFlags.FlowExecutionContext in those platforms.

Nuget version 3.1.0