Does anyone know if there is any work being done t...
# android
z
Does anyone know if there is any work being done to "normalize" exceptions thrown by compose? I often find that while the stack traces themselves are mostly identical, the source will point to seemingly random things -
View
,
ViewGroup
, `BaseContinuationImpl`; usually things that are not directly related to whats actually causing the crash (which is often times a bug in compose, or me abusing it too much).
As an example, I think Ive seen this crash happen about 100 times since I adopted compose (there is a bug report tracking it). The stacktraces almost always point to slightly different things even though the end crash is the same. At the end of the day it just results in many entries in my crashlytics, messing up the statistics, and likely raising my blood pressure.
Copy code
Fatal Exception: java.lang.IllegalArgumentException: offset(1) is out of bounds [0, 1)
       at androidx.compose.ui.text.MultiParagraph.requireIndexInRange(MultiParagraph.java:636)
       at androidx.compose.ui.text.MultiParagraph.getBoundingBox(MultiParagraph.java:370)
       at androidx.compose.ui.text.TextLayoutResult.getBoundingBox(TextLayoutResult.kt:506)
       at androidx.compose.foundation.text.selection.TextFieldSelectionManagerKt.calculateSelectionMagnifierCenterAndroid-O0kMr_c(TextFieldSelectionManagerKt.java:867)
       at androidx.compose.foundation.text.selection.TextFieldSelectionManager_androidKt$textFieldMagnifier$1$1.invoke-F1C5BW0(TextFieldSelectionManager_androidKt.java:51)
       at androidx.compose.foundation.text.selection.TextFieldSelectionManager_androidKt$textFieldMagnifier$1$1.invoke(TextFieldSelectionManager_androidKt.java:49)
       at androidx.compose.foundation.FocusableKt$focusable$2$4$1.invoke$bridge(Focusable.kt:105)
       at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.java:2063)
       at androidx.compose.runtime.DerivedSnapshotState.currentRecord(DerivedState.kt:121)
       at androidx.compose.runtime.DerivedSnapshotState.getCurrentValue(DerivedState.kt:171)
       at androidx.compose.runtime.DerivedSnapshotState.getValue(DerivedState.kt:165)
       at androidx.compose.foundation.text.selection.SelectionMagnifierKt.rememberAnimatedMagnifierPosition$lambda-1(SelectionMagnifierKt.java:128)
       at androidx.compose.foundation.text.selection.SelectionMagnifierKt.access$rememberAnimatedMagnifierPosition$lambda-1(SelectionMagnifierKt.java:1)
       at androidx.compose.foundation.text.selection.SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1$1.invoke-F1C5BW0(SelectionMagnifierKt.java:89)
       at androidx.compose.foundation.MagnifierKt$magnifier$4$4$1.invoke-F1C5BW0$bridge(Magnifier.kt:32)
       at androidx.compose.foundation.text.selection.SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1$1.invoke(SelectionMagnifierKt.java:89)
       at androidx.compose.foundation.MagnifierKt$magnifier$4$4$1.invoke$bridge(Magnifier.kt:20)
       at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invokeSuspend(SnapshotFlow.kt:182)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
       at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
       at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:2)
       at android.os.Handler.handleCallback(Handler.java:900)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:219)
       at android.app.ActivityThread.main(ActivityThread.java:8387)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
r
Maybe https://github.com/Anamorphosee/stacktrace-decoroutinator could "improve" stacktraces in some cases.
👍🏽 1