Skip to content

Commit 156bd27

Browse files
Copilotstephentoub
andcommitted
Fix build failures: restore #if NET guards for allows ref struct in shared files
Co-authored-by: stephentoub <[email protected]>
1 parent 968297f commit 156bd27

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

src/libraries/System.Private.CoreLib/src/System/Collections/Generic/IAsyncEnumerable.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ namespace System.Collections.Generic
88
/// <summary>Exposes an enumerator that provides asynchronous iteration over values of a specified type.</summary>
99
/// <typeparam name="T">The type of values to enumerate.</typeparam>
1010
public interface IAsyncEnumerable<out T>
11+
#if NET
1112
where T : allows ref struct
13+
#endif
1214
{
1315
/// <summary>Returns an enumerator that iterates asynchronously through the collection.</summary>
1416
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that may be used to cancel the asynchronous iteration.</param>

src/libraries/System.Private.CoreLib/src/System/Collections/Generic/IAsyncEnumerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ namespace System.Collections.Generic
88
/// <summary>Supports a simple asynchronous iteration over a generic collection.</summary>
99
/// <typeparam name="T">The type of objects to enumerate.</typeparam>
1010
public interface IAsyncEnumerator<out T> : IAsyncDisposable
11+
#if NET
1112
where T : allows ref struct
13+
#endif
1214
{
1315
/// <summary>Advances the enumerator asynchronously to the next element of the collection.</summary>
1416
/// <returns>

src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/ConfiguredCancelableAsyncEnumerable.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ namespace System.Runtime.CompilerServices
1010
/// <summary>Provides an awaitable async enumerable that enables cancelable iteration and configured awaits.</summary>
1111
[StructLayout(LayoutKind.Auto)]
1212
public readonly struct ConfiguredCancelableAsyncEnumerable<T>
13+
#if NET
1314
where T : allows ref struct
15+
#endif
1416
{
1517
private readonly IAsyncEnumerable<T> _enumerable;
1618
private readonly CancellationToken _cancellationToken;

src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskAsyncEnumerableExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ public static ConfiguredAsyncDisposable ConfigureAwait(this IAsyncDisposable sou
2323
/// <returns>The configured enumerable.</returns>
2424
public static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(
2525
this IAsyncEnumerable<T> source, bool continueOnCapturedContext)
26+
#if NET
2627
where T : allows ref struct
28+
#endif
2729
=> new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext, cancellationToken: default);
2830

2931
/// <summary>Sets the <see cref="CancellationToken"/> to be passed to <see cref="IAsyncEnumerable{T}.GetAsyncEnumerator(CancellationToken)"/> when iterating.</summary>
@@ -33,7 +35,9 @@ public static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(
3335
/// <returns>The configured enumerable.</returns>
3436
public static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(
3537
this IAsyncEnumerable<T> source, CancellationToken cancellationToken)
38+
#if NET
3639
where T : allows ref struct
40+
#endif
3741
=> new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext: true, cancellationToken);
3842
}
3943
}

0 commit comments

Comments
 (0)