Skip to content

Commit 8e5e431

Browse files
committed
Fix incorrect async/await behavior explanation in sample comments (fixes #421)
1 parent ac910fd commit 8e5e431

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/Documentation/Content/AsynchronousServices.aml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@
194194
execution of the task itself. The documentation for asynchronous methods does not distinguish between these
195195
two cases, allowing for any of the specified exceptions to be thrown in either manner.
196196
</para>
197+
<alert class="important">
198+
<para>
199+
This documentation uses the term asynchronous method to refer to any method with a return type of
200+
<codeEntityReference>T:System.Threading.Tasks.Task</codeEntityReference> or
201+
<codeEntityReference>T:System.Threading.Tasks.Task`1</codeEntityReference>. Languages with built-in support
202+
for asynchronous programming have their own related terminology which may differ in meaning.
203+
</para>
204+
</alert>
197205
</content>
198206

199207
<sections>

src/Samples/CSharpCodeSamples/AsynchronousExceptionsExamples.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public void ExceptionPriorToTaskCreation()
1515
}
1616
catch (ArgumentException ex)
1717
{
18-
// ex was thrown directly by SomeOperationAsync. If SomeOperationAsync is marked with the `async`
19-
// keyword, then ex was thrown prior to the first use of the `await` keyword within the implementation.
18+
// ex was thrown directly by SomeOperationAsync. This cannot occur if SomeOperationAsync is an async
19+
// function (§10.15 - C# Language Specification Version 5.0).
2020
}
2121
#endregion
2222
}
@@ -35,9 +35,8 @@ public void ExceptionDuringTaskExecution()
3535
if (ex == null)
3636
throw;
3737

38-
// ex was thrown during the asynchronous portion of SomeOperationAsync. If SomeOperationAsync is marked
39-
// with the `async` keyword, then ex was thrown after the first use of the `await` keyword within the
40-
// method.
38+
// ex was thrown during the asynchronous portion of SomeOperationAsync. This is always the case if
39+
// SomeOperationAsync is an async function (§10.15 - C# Language Specification Version 5.0).
4140
}
4241
#endregion
4342
}

src/Samples/VBCodeSamples/AsynchronousExceptionsExamples.vb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Public Class AsynchronousExceptionsExamples
88
Try
99
Dim myTask As Task = SomeOperationAsync()
1010
Catch ex As ArgumentException
11-
' ex was thrown directly by SomeOperationAsync. If SomeOperationAsync Is marked with the `Async`
12-
' keyword, then ex was thrown prior to the first use of the `Await` keyword within the implementation.
11+
' ex was thrown directly by SomeOperationAsync. This cannot occur if SomeOperationAsync is an async method
12+
' (§10.1.3 - Visual Basic Language Specification Version 11.0).
1313
End Try
1414
' #End Region
1515
End Sub
@@ -25,9 +25,8 @@ Public Class AsynchronousExceptionsExamples
2525
Throw
2626
End If
2727

28-
' ex was thrown during the asynchronous portion of SomeOperationAsync. If SomeOperationAsync Is marked
29-
' with the `Async` keyword, then ex was thrown after the first use of the `Await` keyword within the
30-
' method.
28+
' ex was thrown during the asynchronous portion of SomeOperationAsync. This is always the case if
29+
' SomeOperationAsync is an async method (§10.1.3 - Visual Basic Language Specification Version 11.0).
3130
End Try
3231
' #End Region
3332
End Sub

0 commit comments

Comments
 (0)