You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/analyzers/PH_S034.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Problem
4
4
5
-
C# infers a lambda expression to `async void`. This inference means that neither the asynchronous operation of it can be awaited nor a potential exception may be handled. Furthermore, any unhandled exception of this async lambda may lead to a crash of the application.
5
+
C# may infer a lambda expression to `async void`, depending on the target type. This inference means that neither the asynchronous operation of it can be awaited nor a potential exception may be handled. Furthermore, any unhandled exception of this async lambda may lead to a crash of the application.
6
6
7
7
For example, see the code below. The interface `IWorkQueue` accepts a callback of type `Action`. The `DownloadFile` method provides an inline implementation with an async lambda. This lambda expression will be inferred to `async void`; thus, the completion of the asynchronous operation cannot be awaited by the implementation of `IWorkQueue`. Furthermore, an exception handler will be ineffective.
0 commit comments