Add ManualResetValueTaskSourceCore / AsyncIterateMethodBuilder to Microsoft.Bcl.Async...
authorStephen Toub <stoub@microsoft.com>
Wed, 1 May 2019 15:57:35 +0000 (11:57 -0400)
committerGitHub <noreply@github.com>
Wed, 1 May 2019 15:57:35 +0000 (11:57 -0400)
commit335184a6068dbda69e04eae7e1186a1613caa62f
tree361dab7b0f47ad93eeb22956d523f443aa1c445b
parent41098ac35d1bdd57fd5c7e0547e5fcbca0d7d515
Add ManualResetValueTaskSourceCore / AsyncIterateMethodBuilder to Microsoft.Bcl.AsyncInterfaces (dotnet/corefx#37320)

* Add ManualResetValueTaskSourceCore / AsyncIterateMethodBuilder to Microsoft.Bcl.AsyncInterfaces

These two types needed modifications to target .NET Standard 2.0 and are the necessary pieces to enable the compiler to compile async iterators.

- Copied ManualResetValueTaskSourceCore.cs from coreclr and tweaked it.  I opted to do this rather than ifdef because the changes are not localized and I didn't want to significantly perturb the primary implementation.
- Added a few ifdefs to the shared AsyncIteratorMethodBuilder.  It already had ifdefs, so I just added to it.
- Added a test project, and included the existing ManualResetValueTaskSourceCore tests.  I had to disable two of the tests because of some of the optimization differences.
- Augmented those tests to validate that the compiler is able to successfully generate iterators and await foreach them.

* Address PR feedback

Commit migrated from https://github.com/dotnet/corefx/commit/07b6760a1a84251a50f744e585e4da5f71a25e68
src/libraries/Microsoft.Bcl.AsyncInterfaces/ref/Microsoft.Bcl.AsyncInterfaces.Forwards.cs
src/libraries/Microsoft.Bcl.AsyncInterfaces/ref/Microsoft.Bcl.AsyncInterfaces.cs
src/libraries/Microsoft.Bcl.AsyncInterfaces/ref/Microsoft.Bcl.AsyncInterfaces.csproj
src/libraries/Microsoft.Bcl.AsyncInterfaces/src/Microsoft.Bcl.AsyncInterfaces.csproj
src/libraries/Microsoft.Bcl.AsyncInterfaces/src/System/Runtime/CompilerServices/AsyncIteratorMethodBuilder.cs [new file with mode: 0644]
src/libraries/Microsoft.Bcl.AsyncInterfaces/src/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs [new file with mode: 0644]
src/libraries/Microsoft.Bcl.AsyncInterfaces/tests/Configurations.props [new file with mode: 0644]
src/libraries/Microsoft.Bcl.AsyncInterfaces/tests/Microsoft.Bcl.AsyncInterfaces.Tests.csproj [new file with mode: 0644]
src/libraries/System.Threading.Tasks.Extensions/tests/ManualResetValueTaskSourceTests.cs