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
Comments (1)
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
- Some UXML Template Asset foldouts appear enabled when all fields inside are disabled
- URP Terrain Demo crash on burst_signal_handler after Generating lighting
- Project window button icons are poorly visible and their shades differ in Light theme
- GC.Alloc called by HDRenderPipeline.LensFlareMergeOcclusionDataDrivenPass() when playing the default HDRP Sample Template project
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
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().