Copyright © 2026 Unity Technologies
Won't do any 2.0 fixes, 2.0 is never going to be released
The reason why the editor freezes is that Assert.ThrowsAync blocks the main editor thread. In general we provide IEnumerator alternatives to such calls, which will work instead, but we do not yet have one for ThrowsAsync. Until we add that in a minor release in the future, you are able to work around the issue by adding similar code. The following snippet will use an UnityTest to check on every frame update if the async method is doen running and once it is done, it will evaluate the exception. [UnityTest] public IEnumerator UnityThrowsAsync_WhenCallingAsyncTask_Solution() { yield return AssertThrowAsync<Exception>(ThrowException); } private IEnumerator AssertThrowAsync<T>(AsyncTestDelegate code) where T : Exception { var task = code(); while (!task.IsCompleted) { yield return null; } Assert.That<Exception>(task.Exception != null && task.Exception.InnerExceptions.Count == 1 ? task.Exception.InnerException : task.Exception, new ExceptionTypeConstraint(typeof(T))); }
How to reproduce:
1. Open the attached “ThrowsAsyncBug” project
2. In the main menu bar, select “Window” → “General” → “Test Runner”
3. Run the “ThrowsAsync_WhenCallingAsyncTask_LocksUnityAsync” test
4. Observe the progress bar
Expected result: The progress bar finishes loading without problems
Actual result: The progress bar never finishes, putting the entire Editor in deadlock
Reproducible with: 2.0.1-exp.1 (2021.3.6f1), 2.0.1-pre.12 (2022.1.10f1), 2.0.1-pre.18 (2022.2.0b2)
Couldn’t test with: 1.1.33 (2020.3.37f1), 2.0.1-pre.18 (2023.1.0a4) (Compilation errors)
Reproducible on: Windows 10
Issues you vote on will appear here