Add ManualResetValueTaskSourceCore / AsyncIterateMethodBuilder to Microsoft.Bcl.Async...
authorStephen Toub <stoub@microsoft.com>
Wed, 1 May 2019 15:57:35 +0000 (11:57 -0400)
committerAnirudh Agnihotry <anirudhagnihotry098@gmail.com>
Thu, 2 May 2019 19:00:53 +0000 (12:00 -0700)
commita7404ac368c87e614ee9e181f8a8085c3265e99f
tree066f532787493513b70826fe6354f28bb34db29b
parent780bee637027c48213f5c94e19e8aabbd105e077
Add ManualResetValueTaskSourceCore / AsyncIterateMethodBuilder to Microsoft.Bcl.AsyncInterfaces (#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

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncIteratorMethodBuilder.cs