Search Issue Tracker

Won't Fix

Votes

0

Found in

6000.2.7f1

6000.3.0b4

6000.4.0a1

Issue ID

UUM-121303

Regression

No

Crash on Coroutine::CleanupCoroutineGC when assigning a Coroutine instance using FormatterServices.GetUninitializedObject

-

Steps to reproduce:
1. Open the “user’s attached project”
2. Open “SampleScene”
3. Go to “Window/General/Test Runner” and open the EditorMode tab
4. Press the “Run All” button at the bottom right of the window
5. Observe the crash

Reproducible with versions: 6000.2.7f1, 6000.3.0b4, 6000.4.0a1
Couldn’t test with versions: 6000.0.59f1 (compiler errors)

Reproducible on: macOS 15.6.1 (M1 Max), Windows 10 (by the user)
Not reproducible on: no other environment tested

Note: Also reproducible outside of the Test environment

First few lines of StackTrace:
0x00007FFC604D0960 (Unity) Coroutine::CleanupCoroutineGC
0x00007FFC5F64C9FD (Unity) Coroutine_CUSTOM_ReleaseCoroutine
0x000001E8B5AEF70A (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Coroutine:ReleaseCoroutine (intptr)
0x000001E8B5AEF613 (Mono JIT Code) UnityEngine.Coroutine:Finalize ()
0x000001E8B59FBE2C (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_virtual_void_{}this{}_ (object,intptr,intptr,intptr)

  1. Resolution Note:

    Creating a Coroutine using `FormatterServices.GetUninitializedObject()` is not supported. It creates an uninitialized object with no native backing resulting in the observed crashes.

    Coroutines should only be created using StartCoroutine on a GameObject.

    To get Coroutines to work in tests you will need to make the test a `[UnityTest]` instead of a normal `[Test]`.

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.