Replies: 4 comments 12 replies
-
Maybe unirx can help you.
|
Beta Was this translation helpful? Give feedback.
-
Isn't this default C# behavior? My suggestion would be that if you want the other tasks to be canceled then you do indeed cancel the token. |
Beta Was this translation helpful? Give feedback.
-
any update on this? |
Beta Was this translation helpful? Give feedback.
-
So to actually cancel the remaining task(s) you'd have to create a new token source and cancel it afterwards, right? Something like this:
Does not seem overly verbose to me but maybe there's something I'm missing? |
Beta Was this translation helpful? Give feedback.
-
Hi, I've noticed that using WhenAny systematically creates leaked tasks:
When either event happens, the other task stays pending until the cancellationToken is triggered.
Creating a new merged cancellationToken for every case of WhenAny and canceling it afterward seems tedious and error-prone.
Is there a way to dissolve the tasks after the await?
Is there a simple pattern to deal with these cases gracefully?
Beta Was this translation helpful? Give feedback.
All reactions