Skip to content

Commit 37a08e9

Browse files
committed
Update approved APIs. Fix code gen discrepancies.
Fix erroneous doc comment on ZIP
1 parent 4fda8d0 commit 37a08e9

17 files changed

+726
-2608
lines changed

Ix.NET/Source/System.Interactive.Async/System/Linq/IAsyncIListProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace System.Linq
2424
/// the old version defined in the deprecated <c>System.Linq.Async</c> package) will continue to provide the
2525
/// same (unsupported) behaviour.
2626
/// </remarks>
27-
public interface IAsyncIListProvider<TElement> : IAsyncEnumerable<TElement>
27+
internal interface IAsyncIListProvider<TElement> : IAsyncEnumerable<TElement>
2828
{
2929
/// <summary>
3030
/// Produce an array of the sequence through an optimized path.

Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Average.Generated.cs

Lines changed: 151 additions & 1061 deletions
Large diffs are not rendered by default.

Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Average.Generated.tt

Lines changed: 0 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -148,169 +148,6 @@ else
148148
}
149149
}
150150

151-
/// <summary>
152-
/// Computes the average of an async-enumerable sequence of <see cref="int"/> values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result.
153-
/// </summary>
154-
/// <typeparam name="TSource">The type of elements in the source sequence.</typeparam>
155-
/// <param name="source">An async-enumerable sequence of values to compute the average of.</param>
156-
/// <param name="selector">A transform function to invoke and await on each element of the source sequence.</param>
157-
/// <param name="cancellationToken">An optional cancellation token for cancelling the sequence at any time.</param>
158-
/// <returns>A ValueTask containing the average of the sequence of values.</returns>
159-
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is <see langword="null"/>.</exception>
160-
/// <exception cref="InvalidOperationException">The source sequence is empty.</exception>
161-
/// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
162-
[GenerateAsyncOverload]
163-
private static ValueTask<<#=o.res#>> AverageAwaitAsyncCore<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<<#=o.type#>>> selector, CancellationToken cancellationToken = default)
164-
{
165-
if (source == null)
166-
throw Error.ArgumentNull(nameof(source));
167-
if (selector == null)
168-
throw Error.ArgumentNull(nameof(selector));
169-
170-
return Core(source, selector, cancellationToken);
171-
172-
static async ValueTask<<#=o.res#>> Core(IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<<#=o.type#>>> selector, CancellationToken cancellationToken)
173-
{
174-
<#
175-
if (isNullable)
176-
{
177-
#>
178-
await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false))
179-
{
180-
while (await e.MoveNextAsync())
181-
{
182-
var v = await selector(e.Current).ConfigureAwait(false);
183-
if (v.HasValue)
184-
{
185-
<#=o.sum#> sum = v.GetValueOrDefault();
186-
long count = 1;
187-
checked
188-
{
189-
while (await e.MoveNextAsync())
190-
{
191-
v = await selector(e.Current).ConfigureAwait(false);
192-
if (v.HasValue)
193-
{
194-
sum += v.GetValueOrDefault();
195-
++count;
196-
}
197-
}
198-
}
199-
200-
return <#=res#>;
201-
}
202-
}
203-
}
204-
205-
return null;
206-
<#
207-
}
208-
else
209-
{
210-
#>
211-
await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false))
212-
{
213-
if (!await e.MoveNextAsync())
214-
{
215-
throw Error.NoElements();
216-
}
217-
218-
<#=o.sum#> sum = await selector(e.Current).ConfigureAwait(false);
219-
long count = 1;
220-
checked
221-
{
222-
while (await e.MoveNextAsync())
223-
{
224-
sum += await selector(e.Current).ConfigureAwait(false);
225-
++count;
226-
}
227-
}
228-
229-
return <#=res#>;
230-
}
231-
<#
232-
}
233-
#>
234-
}
235-
}
236-
237-
#if !NO_DEEP_CANCELLATION
238-
[GenerateAsyncOverload]
239-
private static ValueTask<<#=o.res#>> AverageAwaitWithCancellationAsyncCore<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<<#=o.type#>>> selector, CancellationToken cancellationToken = default)
240-
{
241-
if (source == null)
242-
throw Error.ArgumentNull(nameof(source));
243-
if (selector == null)
244-
throw Error.ArgumentNull(nameof(selector));
245-
246-
return Core(source, selector, cancellationToken);
247-
248-
static async ValueTask<<#=o.res#>> Core(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<<#=o.type#>>> selector, CancellationToken cancellationToken)
249-
{
250-
<#
251-
if (isNullable)
252-
{
253-
#>
254-
await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false))
255-
{
256-
while (await e.MoveNextAsync())
257-
{
258-
var v = await selector(e.Current, cancellationToken).ConfigureAwait(false);
259-
if (v.HasValue)
260-
{
261-
<#=o.sum#> sum = v.GetValueOrDefault();
262-
long count = 1;
263-
checked
264-
{
265-
while (await e.MoveNextAsync())
266-
{
267-
v = await selector(e.Current, cancellationToken).ConfigureAwait(false);
268-
if (v.HasValue)
269-
{
270-
sum += v.GetValueOrDefault();
271-
++count;
272-
}
273-
}
274-
}
275-
276-
return <#=res#>;
277-
}
278-
}
279-
}
280-
281-
return null;
282-
<#
283-
}
284-
else
285-
{
286-
#>
287-
await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false))
288-
{
289-
if (!await e.MoveNextAsync())
290-
{
291-
throw Error.NoElements();
292-
}
293-
294-
<#=o.sum#> sum = await selector(e.Current, cancellationToken).ConfigureAwait(false);
295-
long count = 1;
296-
checked
297-
{
298-
while (await e.MoveNextAsync())
299-
{
300-
sum += await selector(e.Current, cancellationToken).ConfigureAwait(false);
301-
++count;
302-
}
303-
}
304-
305-
return <#=res#>;
306-
}
307-
<#
308-
}
309-
#>
310-
}
311-
}
312-
#endif
313-
314151
<#
315152
}
316153
#>

Ix.NET/Source/System.Linq.Async/System/Linq/IAsyncIListProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace System.Linq
1919
/// its own version of this interface. We can't replace this with a type forwarder here because that would risk creating a
2020
/// circular dependency in cases where an application managed to get out-of-sync versions of the two packages.
2121
/// </remarks>
22-
[Obsolete("Use the definition of this type in the System.Interactive.Async NuGet package System.Linq.Async instead.")] // Can't use a type forwarder because
22+
[Obsolete("This interface was always unsupported, and the IAsyncEnumerable<T> LINQ implementation in System.Linq.AsyncEnumerable does not recognize it, so this no longer serves a purpose")]
2323
public interface IAsyncIListProvider<TElement> : IAsyncEnumerable<TElement>
2424
{
2525
/// <summary>

0 commit comments

Comments
 (0)