Kotlin/kotlinx.coroutines

java.lang.IllegalStateException: The test scheduler entered an invalid state

basant-kumar opened this issue · 0 comments

I am getting this error in my instrumentation test.

java.lang.IllegalStateException: The test scheduler entered an invalid state. Please report this at https://github.com/Kotlin/kotlinx.coroutines/issues.
at kotlinx.coroutines.test.TestCoroutineSchedulerKt.invalidSchedulerState(TestCoroutineScheduler.kt:217)
at kotlinx.coroutines.test.TestCoroutineSchedulerKt.currentTimeAheadOfEvents(TestCoroutineScheduler.kt:214)
at kotlinx.coroutines.test.TestCoroutineSchedulerKt.access$currentTimeAheadOfEvents(TestCoroutineScheduler.kt:1)
at kotlinx.coroutines.test.TestCoroutineScheduler.advanceTimeBy(TestCoroutineScheduler.kt:169)
at androidx.compose.ui.test.junit4.AbstractMainTestClock$advanceDispatcher$1.invoke(AbstractMainTestClock.kt:68)
at androidx.compose.ui.test.junit4.AbstractMainTestClock$advanceDispatcher$1.invoke(AbstractMainTestClock.kt:67)
at androidx.compose.ui.test.junit4.AndroidSynchronization_androidKt.runOnUiThread(AndroidSynchronization.android.kt:33)
at androidx.compose.ui.test.junit4.MainTestClockImpl$1.invoke(MainTestClockImpl.android.kt:32)
at androidx.compose.ui.test.junit4.MainTestClockImpl$1.invoke(MainTestClockImpl.android.kt:32)
at androidx.compose.ui.test.junit4.AbstractMainTestClock.advanceDispatcher(AbstractMainTestClock.kt:67)
at androidx.compose.ui.test.junit4.AbstractMainTestClock.advanceTimeByFrame(AbstractMainTestClock.kt:38)
at androidx.compose.ui.test.junit4.ComposeIdlingResource.isIdleNow(ComposeIdlingResource.android.kt:74)
at androidx.compose.ui.test.junit4.IdlingResourceRegistry.areAllResourcesIdle(IdlingResourceRegistry.jvm.kt:124)
at androidx.compose.ui.test.junit4.IdlingResourceRegistry.access$areAllResourcesIdle(IdlingResourceRegistry.jvm.kt:29)
at androidx.compose.ui.test.junit4.IdlingResourceRegistry$isIdleOrEnsurePolling$1$1$1.invokeSuspend(IdlingResourceRegistry.jvm.kt:108)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:14)
at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:8)
at androidx.test.espresso.base.UiControllerImpl.loopMainThreadUntilIdle(UiControllerImpl.java:16)
at androidx.test.espresso.Espresso$1.run(Espresso.java:1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@ff29dd6, Dispatchers.Main]