Search Issue Tracker
Fixed
Fixed in 1.1.10
Votes
0
Found in [Package]
1.1.9
Issue ID
DSTR-10
Regression
No
[TestRunner] "EditMode test can only yield null" error is thrown when two or more yield returns are used in one test
Further investigation showed that it is not the nested-IEnumerator situation that doesn't work, but the nested-Ienumerator+AsyncOperation that is not handled as an AsyncOperation in the right place/time. The solution introduced in the PR, works for this case but introduces thread-related problems in other cases. Example AsyncProgressBar.ProgresTests.SynchronousProtectionInMultithreaded()
How to reproduce:
1. Open the attached "case_1171956" project
2. Go to Window -> General -> Test Runner
3. Run all tests
Expected result: Both tests will pass
Actual result: Only test with one yield return passes
Reproducible with: 2017.4.31f1, 2018.4.5f1, 2019.1.13f1, 2019.2.0f1, 2019.3.0a11
Full error message:
EditMode test can only yield null
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Additional notes:
1. This issue occurs only in tests. Calling two or more yield returns in MonoBehavior script works as expected
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- onDisable not always called for SearchProvider
- Build failure errors are cleared in console before you can read them
- Sprite Library Editor contains corrupted and low resolution icons
- [Linux] Players Application window does not update on move when window is changed from full-screen mode
- [Lost Crypt] Build fails in U6
barbarbarian
Mar 14, 2023 01:38
Multiple yield returns in a single [UnitTest] works for me. However, I did get this error when I was trying to run my async call with a yield return. Make sure you are only using yield return with a method of type IEnumerator or if you are trying to running a method that is async but not IEnumerator (so like a task), trying using AsIEnumerator() - that is: myAsyncTaskMethod.AsIEnumerator().