Skip to content

Commit 791d078

Browse files
author
Oren Novotny
committed
Update visibility on AsyncEnumberableExtensions to hideit from the ref on .NET Standard 2.1
1 parent 03dbe96 commit 791d078

File tree

1 file changed

+11
-32
lines changed

1 file changed

+11
-32
lines changed

Ix.NET/Source/System.Linq.Async/System/Threading/Tasks/AsyncEnumerableExtensions.cs

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77

88
namespace System.Threading.Tasks
99
{
10-
public static class AsyncEnumerableExtensions
10+
11+
// This type is only public for ref assms < .NET Standard 2.1 and implementations
12+
#if !BCL_HAS_CONFIGUREAWAIT || !REFERENCE_ASSEMBLY
13+
public
14+
#else
15+
internal
16+
#endif
17+
static class AsyncEnumerableExtensions
1118
{
1219
#if !BCL_HAS_CONFIGUREAWAIT // https://github.com/dotnet/coreclr/pull/21939
1320

@@ -37,8 +44,9 @@ public static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(
3744
new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext: true, cancellationToken);
3845

3946

40-
#elif !REFERENCE_ASSEMBLY
41-
// we need to carry an impl that delegates to the BCL version of these
47+
#else
48+
// we need to carry an impl that delegates to the BCL version of these in the lib
49+
// They won't be in the ref
4250

4351
/// <summary>Configures how awaits on the tasks returned from an async disposable will be performed.</summary>
4452
/// <param name="source">The source async disposable.</param>
@@ -65,35 +73,6 @@ public static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(
6573
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6674
public static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(
6775
this IAsyncEnumerable<T> source, CancellationToken cancellationToken) => TaskExtensions.WithCancellation(source, cancellationToken);
68-
69-
#else
70-
// Reference assembly, these won't be emitted, but keep these internal so we can compile
71-
72-
/// <summary>Configures how awaits on the tasks returned from an async disposable will be performed.</summary>
73-
/// <param name="source">The source async disposable.</param>
74-
/// <param name="continueOnCapturedContext">Whether to capture and marshal back to the current context.</param>
75-
/// <returns>The configured async disposable.</returns>
76-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
77-
internal static ConfiguredAsyncDisposable ConfigureAwait(this IAsyncDisposable source, bool continueOnCapturedContext) =>
78-
TaskExtensions.ConfigureAwait(source, continueOnCapturedContext);
79-
80-
/// <summary>Configures how awaits on the tasks returned from an async iteration will be performed.</summary>
81-
/// <typeparam name="T">The type of the objects being iterated.</typeparam>
82-
/// <param name="source">The source enumerable being iterated.</param>
83-
/// <param name="continueOnCapturedContext">Whether to capture and marshal back to the current context.</param>
84-
/// <returns>The configured enumerable.</returns>
85-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
86-
internal static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(
87-
this IAsyncEnumerable<T> source, bool continueOnCapturedContext) => TaskExtensions.ConfigureAwait(source, continueOnCapturedContext);
88-
89-
/// <summary>Sets the <see cref="CancellationToken"/> to be passed to <see cref="IAsyncEnumerable{T}.GetAsyncEnumerator(CancellationToken)"/> when iterating.</summary>
90-
/// <typeparam name="T">The type of the objects being iterated.</typeparam>
91-
/// <param name="source">The source enumerable being iterated.</param>
92-
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to use.</param>
93-
/// <returns>The configured enumerable.</returns>
94-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
95-
internal static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(
96-
this IAsyncEnumerable<T> source, CancellationToken cancellationToken) => TaskExtensions.WithCancellation(source, cancellationToken);
9776
#endif
9877
}
9978
}

0 commit comments

Comments
 (0)