diff --git a/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs b/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs index 4ec931c4af31..0784e6135c83 100644 --- a/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs +++ b/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs @@ -39,7 +39,7 @@ public struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion /// The value being awaited. private ValueTask _value; // Methods are called on this; avoid making it readonly so as to avoid unnecessary copies /// The value to pass to ConfigureAwait. - private readonly bool _continueOnCapturedContext; + internal readonly bool _continueOnCapturedContext; /// Initializes the awaiter. /// The value to be awaited. @@ -66,6 +66,9 @@ public void OnCompleted(Action continuation) => /// Schedules the continuation action for the . public void UnsafeOnCompleted(Action continuation) => _value.AsTask().ConfigureAwait(_continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation); + + /// Gets the task underlying . + internal Task AsTask() => _value.AsTask(); } } } diff --git a/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs b/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs index c4194825217a..30e688e07711 100644 --- a/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs +++ b/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs @@ -33,5 +33,8 @@ public void OnCompleted(Action continuation) => /// Schedules the continuation action for this ValueTask. public void UnsafeOnCompleted(Action continuation) => _value.AsTask().ConfigureAwait(continueOnCapturedContext: true).GetAwaiter().UnsafeOnCompleted(continuation); + + /// Gets the task underlying . + internal Task AsTask() => _value.AsTask(); } }