Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for AsyncInterfaces #88432

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);netstandard2.1</TargetFrameworks>
<!-- Public API not fully documented. -->
<NoWarn>$(NoWarn);1591</NoWarn>
<IsPackable>true</IsPackable>
<!-- This assembly should never be placed inbox as it is only for downlevel compatibility. -->
<PackageDescription>Provides the IAsyncEnumerable&lt;T&gt; and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ internal ConfiguredAsyncDisposable(IAsyncDisposable source, bool continueOnCaptu
_continueOnCapturedContext = continueOnCapturedContext;
}

/// <summary>Asynchronously releases the unmanaged resources used by the <see cref="T:System.Runtime.CompilerServices.ConfiguredAsyncDisposable" />.</summary>
/// <returns>A task that represents the asynchronous dispose operation.</returns>
Copy link
Member

Choose a reason for hiding this comment

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

It's not actually a task. But I see this matches what we have documented, so, fine for now.

Copy link
Member

Choose a reason for hiding this comment

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

I've seen other places where we say "A task that represents" when the returned value is the result of a ConfigureAwait.

For future reference, what description would you prefer to use in plain English for these cases? Would this work?:

"An awaitable, configured value task that represents..."

Or would you use something else?

public ConfiguredValueTaskAwaitable DisposeAsync() =>
// as with other "configured" awaitable-related type in CompilerServices, we don't null check to defend against
// misuse like `default(ConfiguredAsyncDisposable).DisposeAsync()`, which will null ref by design.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait(bool continueOnCapt
public ConfiguredCancelableAsyncEnumerable<T> WithCancellation(CancellationToken cancellationToken) =>
new ConfiguredCancelableAsyncEnumerable<T>(_enumerable, _continueOnCapturedContext, cancellationToken);

/// <summary>Returns an enumerator that iterates asynchronously through collections that enables cancelable iteration and configured awaits.</summary>
/// <returns>An enumerator for the <see cref="T:System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1" /> class.</returns>
public Enumerator GetAsyncEnumerator() =>
// as with other "configured" awaitable-related type in CompilerServices, we don't null check to defend against
// misuse like `default(ConfiguredCancelableAsyncEnumerable<T>).GetAsyncEnumerator()`, which will null ref by design.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

namespace System.Runtime.CompilerServices
{
/// <summary>Allows users of async-enumerable methods to mark the parameter that should receive the cancellation token value from <see cref="M:System.Collections.Generic.IAsyncEnumerable`1.GetAsyncEnumerator(System.Threading.CancellationToken)" />.</summary>
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
public sealed class EnumeratorCancellationAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.CompilerServices.EnumeratorCancellationAttribute" /> class.</summary>
public EnumeratorCancellationAttribute()
{
}
Expand Down