-
-
Notifications
You must be signed in to change notification settings - Fork 854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WhenAll exits early when any task has an exception #514
Comments
Yes, the reason WhenAll behaves differently than Task.WhenAll is due to a failure in my initial design. |
If it helps, I recently solved this problem in my promise library by adding Promise.AllSettled to match the javascript method. You could do the same by adding |
Has anyone checked out this solution? (by @adammyhre) Source, see |
It might be possible to convert UniTask to Task using AsTask(), then use Task.WhenAll() to replace UniTask.WhenAll() |
It seems as though WhenAll immediately fails with an exception if any awaited task throws an exception, instead of waiting for all the tasks to complete and then throwing the exception. I believe this is different than normal Task behavior which would wait until all tasks are completed regardless of whether some of them failed.
This was unexpected behavior for me because I am expecting some tasks to fail occasionally, but I still need to know that all tasks are done before continuing. I understand from #335 that WhenAll doesn't store the exceptions for individual tasks, but I think it should not convert to WhenAny just because one task failed...perhaps it could store the first exception that happened and then re-throw that when all tasks are done?
Or, is there some way I'm missing to wait for all tasks to complete regardless of failure?
The text was updated successfully, but these errors were encountered: