Skip to content

Commit a017ea7

Browse files
authored
Merge pull request #1332 from AArnott/documentThrowingBehaviors
Document Join APIs that may propagate exceptions
2 parents fe92bf7 + 8f52508 commit a017ea7

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/Microsoft.VisualStudio.Threading/JoinableTask.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,10 @@ private Task QueueNeedProcessEvent
568568
/// the caller's access to the Main thread propagates to this JoinableTask so that it may also access the main thread.
569569
/// </summary>
570570
/// <param name="cancellationToken">A cancellation token that will exit this method before the task is completed.</param>
571+
/// <exception cref="OperationCanceledException">Thrown when <paramref name="cancellationToken"/> is canceled.</exception>
572+
/// <remarks>
573+
/// Any exception thrown by the asynchronous operation is propagated out to the caller of this method.
574+
/// </remarks>
571575
public void Join(CancellationToken cancellationToken = default(CancellationToken))
572576
{
573577
cancellationToken.ThrowIfCancellationRequested();
@@ -599,6 +603,10 @@ private Task QueueNeedProcessEvent
599603
/// before the async operation has completed.
600604
/// </param>
601605
/// <returns>A task that completes after the asynchronous operation completes and the join is reverted.</returns>
606+
/// <exception cref="OperationCanceledException">Thrown when <paramref name="cancellationToken"/> is canceled.</exception>
607+
/// <remarks>
608+
/// Any exception thrown by the asynchronous operation is propagated out to the caller of this method.
609+
/// </remarks>
602610
public Task JoinAsync(CancellationToken cancellationToken = default(CancellationToken))
603611
{
604612
cancellationToken.ThrowIfCancellationRequested();

src/Microsoft.VisualStudio.Threading/JoinableTaskCollection.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,19 @@ public JoinRelease Join()
145145
/// Joins the caller's context to this collection till the collection is empty.
146146
/// </summary>
147147
/// <returns>A task that completes when this collection is empty.</returns>
148+
/// <remarks>
149+
/// Any exceptions thrown by the tasks in this collection are <em>not</em> propagated to the returned task.
150+
/// </remarks>
148151
public Task JoinTillEmptyAsync() => this.JoinTillEmptyAsync(CancellationToken.None);
149152

150153
/// <summary>
151154
/// Joins the caller's context to this collection till the collection is empty.
152155
/// </summary>
153156
/// <param name="cancellationToken">A cancellation token.</param>
154157
/// <returns>A task that completes when this collection is empty, or is canceled when <paramref name="cancellationToken"/> is canceled.</returns>
158+
/// <remarks>
159+
/// Any exceptions thrown by the tasks in this collection are <em>not</em> propagated to the returned task.
160+
/// </remarks>
155161
public async Task JoinTillEmptyAsync(CancellationToken cancellationToken)
156162
{
157163
cancellationToken.ThrowIfCancellationRequested();

src/Microsoft.VisualStudio.Threading/JoinableTask`1.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ internal JoinableTask(JoinableTaskFactory owner, bool synchronouslyBlocking, str
4848
/// </summary>
4949
/// <param name="cancellationToken">A cancellation token that will exit this method before the task is completed.</param>
5050
/// <returns>A task that completes after the asynchronous operation completes and the join is reverted, with the result of the operation.</returns>
51+
/// <exception cref="OperationCanceledException">Thrown when <paramref name="cancellationToken"/> is canceled.</exception>
52+
/// <remarks>
53+
/// Any exception thrown by the asynchronous operation is propagated out to the caller of this method.
54+
/// </remarks>
5155
public new Task<T> JoinAsync(CancellationToken cancellationToken = default(CancellationToken))
5256
{
5357
return this.JoinAsync(continueOnCapturedContext: AwaitShouldCaptureSyncContext, cancellationToken);
@@ -59,6 +63,10 @@ internal JoinableTask(JoinableTaskFactory owner, bool synchronouslyBlocking, str
5963
/// </summary>
6064
/// <param name="cancellationToken">A cancellation token that will exit this method before the task is completed.</param>
6165
/// <returns>The result of the asynchronous operation.</returns>
66+
/// <exception cref="OperationCanceledException">Thrown when <paramref name="cancellationToken"/> is canceled.</exception>
67+
/// <remarks>
68+
/// Any exception thrown by the asynchronous operation is propagated out to the caller of this method.
69+
/// </remarks>
6270
public new T Join(CancellationToken cancellationToken = default(CancellationToken))
6371
{
6472
base.Join(cancellationToken);

0 commit comments

Comments
 (0)