I found that Compose UI swallows error log(but sti...
# compose
l
I found that Compose UI swallows error log(but still freezes) inside some places(which seems to be called from ui nodes?) for example inside
graphicsLayer { /* this lambda */ }
so far harder to debug. Why does this happen?
Copy code
W/System.err:     at mypackage.SomeComposable$modifier$1$1.invoke(composeUtils.kt:119) // <- my fault
W/System.err:     at androidx.compose.ui.node.LayoutNodeWrapper$updateLayerParameters$1.invoke(LayoutNodeWrapper.kt:307)
W/System.err:     at androidx.compose.ui.node.LayoutNodeWrapper$updateLayerParameters$1.invoke(LayoutNodeWrapper.kt:306)
W/System.err:     at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:1788)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:119)
W/System.err:     at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:75)
W/System.err:     at androidx.compose.ui.node.LayoutNodeWrapper.updateLayerParameters(LayoutNodeWrapper.kt:306)
W/System.err:     at androidx.compose.ui.node.LayoutNodeWrapper.access$updateLayerParameters(LayoutNodeWrapper.kt:53)
W/System.err:     at androidx.compose.ui.node.LayoutNodeWrapper$Companion$onCommitAffectingLayerParams$1.invoke(LayoutNodeWrapper.kt:804)
W/System.err:     at androidx.compose.ui.node.LayoutNodeWrapper$Companion$onCommitAffectingLayerParams$1.invoke(LayoutNodeWrapper.kt:802)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotStateObserver$ApplyMap.callOnChanged(SnapshotStateObserver.kt:270)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotStateObserver.callOnChanged(SnapshotStateObserver.kt:213)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotStateObserver.access$callOnChanged(SnapshotStateObserver.kt:24)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotStateObserver$applyObserver$1$2.invoke(SnapshotStateObserver.kt:46)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotStateObserver$applyObserver$1$2.invoke(SnapshotStateObserver.kt:45)
W/System.err:     at androidx.compose.ui.platform.AndroidComposeView$snapshotObserver$1.invoke(AndroidComposeView.android.kt:234)
W/System.err:     at androidx.compose.ui.platform.AndroidComposeView$snapshotObserver$1.invoke(AndroidComposeView.android.kt:232)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotStateObserver$applyObserver$1.invoke(SnapshotStateObserver.kt:45)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotStateObserver$applyObserver$1.invoke(SnapshotStateObserver.kt:26)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotKt.advanceGlobalSnapshot(Snapshot.kt:1440)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotKt.advanceGlobalSnapshot(Snapshot.kt:1459)
W/System.err:     at androidx.compose.runtime.snapshots.SnapshotKt.access$advanceGlobalSnapshot(Snapshot.kt:1)
W/System.err:     at androidx.compose.runtime.snapshots.Snapshot$Companion.sendApplyNotifications(Snapshot.kt:462)
W/System.err:     at androidx.compose.ui.platform.GlobalSnapshotManager$ensureStarted$1.invokeSuspend(GlobalSnapshotManager.android.kt:46)
W/System.err:     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/System.err:     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
W/System.err:     at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
W/System.err:     at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
W/System.err:     at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
W/System.err:     at android.os.Handler.handleCallback(Handler.java:938)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err:     at android.os.Looper.loop(Looper.java:223)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7656)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
This is what I got from try-catch:
Copy code
Modifier.graphicsLayer { someError() }
a
Can you file a bug for this one? I see a couple of things in that stack trace that look off that I'd like for us to investigate
l
Maybe it's my app's problem... Making a new clean project, Compose does not swallow errors.
Sorry. I had set DefaultUncaughtExceptionHandler. It works well as expected.
👍 1