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
- "One or more data file missing for baking set NewScene Baking Set. Cannot load shared data." error in Player when a specific project is built
- Choosing new HDR Colour using RGB values breaks colour on Intensity Selectors
- Rendering/Decal Layer Mask options are different inside Prefab Mode and outside Prefab Mode when the project is upgraded to Unity 6
- Incorrect Realtime GI Light Probes baking when more than one Light Probe Group is used and "Baked Global Illumination" is enabled
- Hovering on the three-dot menu also highlights the tab header near it when not all tabs fit the bar
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().