Closed yfital closed 2 years ago
The current behavior is as-designed. It has the same behavior as the new Task.WaitAsync
method in .NET 6.
By canceling the wait, you do end up with a possible unobserved exception, so having it go through the normal UnobservedTaskException
is expected.
Hey,
Currently, we use the WaitAsync for various external methods which do not support CT. It is great from the client POV, but it still poses an unobserved threat.
A simple example of the problem:
Running the above will result in:
Suggestion:
I'm leaning toward the first solution, but they are more or less equal. Of course, instead of console write line, it should be an OnError lambda.
If approved, I'll open a PR.