Tash
11/15/2022, 7:20 PMjava.lang.IllegalStateException: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition.
We don’t seem to be creating `mutableStateOf`s explicitly at all, much less modifying them on both sides of Composition boundaries…Any tips on where to start looking? Any help is much appreciated! 🙏🏼
More in 🧵Tash
11/15/2022, 7:22 PM1.2.0
Compose Compiler version: 1.3.0
Full trace (this is all of the trace - the trace doesn’t actually point to the offending code 😞)
java.lang.IllegalStateException: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition.
at (Coroutine boundary.()
at androidx.compose.runtime.PausableMonotonicFrameClock.withFrameNanos(PausableMonotonicFrameClock.kt:63)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt:454)
at androidx.compose.runtime.Recomposer$recompositionRunner$2$2.invokeSuspend(Recomposer.kt:745)
at androidx.compose.runtime.Recomposer$recompositionRunner$2.invokeSuspend(Recomposer.kt:744)
at androidx.compose.ui.platform.WindowRecomposer_androidKt$createLifecycleAwareWindowRecomposer$2$onStateChanged$1.invokeSuspend(WindowRecomposer.android.kt:391)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@7eb0113, androidx.compose.ui.platform.MotionDurationScaleImpl@1156f50, CoroutineId(2420), "coroutine#2420":StandaloneCoroutine
{Cancelling}
@5eaf549, AndroidUiDispatcher@b3cde4e]
Caused by: java.lang.IllegalStateException: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition.
at androidx.compose.runtime.Recomposer.applyAndCheck(Recomposer.kt:957)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1283)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:107)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:485)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:454)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
robercoding
11/15/2022, 7:39 PMTash
11/15/2022, 8:37 PMIt’s a bit difficult to know what’s causing that without any codeI agree…the problem is I have no idea what the offending code may even be…so I have no idea what snippet to post…TL;DR - its a screen with a
TextField
and a dropdown menu with a LazyColumn
- the state is coming from a StateFlow
where collectAsState()
is used.
I think this has happened to me once in the past,Oh interesting! Do you happen to remember what the culprit was?
do you have some coroutine going on or modifying something in a sneaky wayThe only thing we do is
rememberCoroutineScope()
to animate a `LazyListState`… which should be typical, I thinkBen Trengrove [G]
11/15/2022, 10:29 PMTash
11/15/2022, 11:25 PMStylianos Gakis
11/15/2022, 11:32 PMTash
11/15/2022, 11:57 PMLazyColumn
with Column
because of possible instability with LazyColumn
🤞🏼Tash
11/16/2022, 1:07 AMshikasd
11/16/2022, 12:11 PMWindowRecomposer
things that are a bit suspicious
Can you try to file a bug with a small repro?Andy Himberger
11/17/2022, 4:37 AMTash
11/17/2022, 7:25 PMWindowRecomposer
idea makes sense @shikasd.
Might try to file a bug (although minimal repro might be hard to get)