Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Add ManualResetValueTaskSourceCore / AsyncIterateMethodBuilder to Microsoft.Bcl.AsyncInterfaces #37320

Merged
merged 2 commits into from
May 1, 2019

Conversation

stephentoub
Copy link
Member

Follow-up to #37189
cc: @joperezr, @ericstj, @Petermarcu, @terrajobst

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.

With this, the package has all the core pieces. The only remaining piece are a few helper extension methods, but I need to first move where they live in coreclr.

…rosoft.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.
@stephentoub stephentoub merged commit 07b6760 into dotnet:master May 1, 2019
@stephentoub stephentoub deleted the addcompilertypes branch May 1, 2019 15:57
@jkotas
Copy link
Member

jkotas commented May 1, 2019

@Anipik @safern The CoreLib mirror is not picking up this change. Could you please take a look?

@@ -42,7 +42,7 @@ public struct AsyncIteratorMethodBuilder
/// <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
#if CORERT || MICROSOFT_BCL_ASYNCINTERFACES_PACKAGE
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoot, I meant to revert all changes to this file, but apparently I didn't push that commit. Will do so in a subsequent PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also remove the CORERT ifdef while you are on it? (I will close my PR to remove it then.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do.

@joperezr
Copy link
Member

joperezr commented May 1, 2019

Changes LGTM.

@karelz karelz added this to the 3.0 milestone May 4, 2019
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…rosoft.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 dotnet/corefx@07b6760
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants