Search Issue Tracker

Duplicate

Votes

0

Found in [Package]

Issue ID

1401604

Regression

No

NullReferenceException when exiting PlayMode in test

Package: Test-Framework

-

How to reproduce:
1. Open attached Unity project
2. Open Test Runner window
3. Select PlayMode tests
4. Run tests
5. Observe console

Expected result: PlayMode exists successfully.
Actual result: NullReferenceException is thrown.

Reproduced with: 2022.2.0a4, 2022.2.0a1, 2022.1.0b7, 2022.1.0a1, 2021.2.11f1, 2021.2.0a1, 2020.3.29f1, 2020.3.0f1, 2019.4.36f1, 2019.4.0f1.

Full error:
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.TestTools.TestRunner.PlaymodeTestsController+<TestRunnerCoroutine>d__15.MoveNext () (at Library/PackageCache/com.unity.test-framework@1.1.30/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs:74)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <84f51b1b0ff2473ca787c217e1eda8b9>:0)

Notes:
This mostly causes issues when there is DontDestroyOnLoad object with a static value in a scene. It remains through all the tests and it's not unloaded between tests.
In the attached image you can see that test fails because it's canceled by user.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.