#514·UniTask

WhenAll exits early when any task has an exception

Author: all-iverCreated Oct 22, 2023Updated Apr 13, 2026

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?