Cysharp / Cysharp/UniTask

WhenAll exits early when any task has an exception

Open
#514 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
11.2k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names WhenAll but no source file or test. Locate the WhenAll implementation, then compare its completion and exception behavior with normal Task.WhenAll and check the existing discussion in #335. Done means the behavior is verified against the reported expectation and covered by focused tests or a clearly supported workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.