accompanist icon indicating copy to clipboard operation
accompanist copied to clipboard

[Navigation] Sometimes crash occurs while hiding the dialog

Open WonderCsabo opened this issue 3 years ago • 17 comments

Description I see some crash reports in Firebase. It seems there is a state when the anchors are not calculated, and we navigate away from the dialog.

Fatal Exception: java.lang.IllegalArgumentException: The target value must have an associated anchor.
       at androidx.compose.material.SwipeableState$snapTo$$inlined$collect$1.emit(Collect.kt:136)
       at kotlinx.coroutines.flow.FlowKt__LimitKt.emitAbort$FlowKt__LimitKt(Limit.kt:73)
       at kotlinx.coroutines.flow.FlowKt__LimitKt.access$emitAbort$FlowKt__LimitKt(Limit.kt:1)
       at kotlinx.coroutines.flow.FlowKt__LimitKt$take$lambda-7$$inlined$collect$1.emit(Collect.kt:138)
       at androidx.compose.material.SwipeableState$special$$inlined$filter$1$2.emit(Collect.kt:137)
       at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
       at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:77)
       at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:59)
       at androidx.compose.runtime.SnapshotStateKt$snapshotFlow$1.invokeSuspend(SnapshotState.kt:891)
       at androidx.compose.runtime.SnapshotStateKt$snapshotFlow$1.invoke(SnapshotState.kt:2)
       at kotlinx.coroutines.flow.SafeFlow.collectSafely(SafeFlow.java:61)
       at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
       at androidx.compose.material.SwipeableState$special$$inlined$filter$1.collect(SafeCollector.common.kt:114)
       at kotlinx.coroutines.flow.FlowKt__LimitKt$take$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:116)
       at androidx.compose.material.SwipeableState.snapTo(SwipeableState.java:943)
       at com.google.accompanist.navigation.material.SheetContentHostKt.internalHide(SheetContentHostKt.java:188)
       at com.google.accompanist.navigation.material.SheetContentHostKt.access$internalHide(SheetContentHostKt.java:1)
       at com.google.accompanist.navigation.material.SheetContentHostKt$SheetContentHost$2$2$1.invokeSuspend(SheetContentHost.kt:145)
       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:57)
       at android.os.Handler.handleCallback(Handler.java:938)
       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:7838)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Steps to reproduce I could not create a reproducing code, yet.

Expected behavior This code is already wrapped in a try block, maybe it should catch all exceptions just to be sure.

WonderCsabo avatar Dec 21 '21 12:12 WonderCsabo

@WonderCsabo Thanks for the report. Do you have the exception that's thrown by chance?

jossiwolf avatar Jan 03 '22 13:01 jossiwolf

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Feb 03 '22 03:02 github-actions[bot]

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Mar 06 '22 03:03 github-actions[bot]

@jossiwolf sorry for the late response. I edited the stacktrace!

WonderCsabo avatar Mar 08 '22 18:03 WonderCsabo

I just realized this might be a duplicate, we also discussed it here: https://github.com/google/accompanist/issues/910#issuecomment-1041872681.

WonderCsabo avatar Mar 08 '22 18:03 WonderCsabo

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 08 '22 03:04 github-actions[bot]

This issue is still happening very frequently according to our Crashlytics reports.

WonderCsabo avatar Apr 08 '22 08:04 WonderCsabo

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar May 09 '22 03:05 github-actions[bot]

Still happenning.

WonderCsabo avatar May 09 '22 11:05 WonderCsabo

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jun 09 '22 03:06 github-actions[bot]

This is still happening.

WonderCsabo avatar Jun 09 '22 09:06 WonderCsabo

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jul 10 '22 03:07 github-actions[bot]

This is still happening.

WonderCsabo avatar Jul 14 '22 08:07 WonderCsabo

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Aug 15 '22 03:08 github-actions[bot]

This is still happening.

WonderCsabo avatar Aug 15 '22 08:08 WonderCsabo

@jossiwolf can you reopen this, please?

WonderCsabo avatar Aug 21 '22 08:08 WonderCsabo

Upstream issue for the root cause: https://issuetracker.google.com/issues/167966118 We're working on it but it will still take some time to address.

jossiwolf avatar Sep 23 '22 16:09 jossiwolf

v0.29.0-alpha addresses this issue. Please let us know if you can still reproduce it with this version.

jossiwolf avatar Jan 12 '23 07:01 jossiwolf

Hey @jossiwolf - it seems that v0.28.1 has not been released yet - wanted to ask if this is expected

scana avatar Jan 23 '23 11:01 scana

Apologies, it's v0.29.0-alpha.

jossiwolf avatar Jan 23 '23 11:01 jossiwolf