Threading violation crashes the app
I'm seeing this in the logcat:
Threading violation: {Instabug.getTags} should only be called from a background thread, but was called from main thread.
Which seems to somehow crash the Compose compiler:
CrashReporting InstabugUncaughtExceptionHandler Caught an Unhandled Exception: java.lang.NullPointerException
java.lang.NullPointerException
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ApplyMap.addValue(SnapshotStateObserver.kt:254)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$readObserver$1.invoke(SnapshotStateObserver.kt:54)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$readObserver$1.invoke(SnapshotStateObserver.kt:51)
at androidx.compose.runtime.snapshots.SnapshotKt.readable(Snapshot.kt:1823)
Steps to Reproduce the Problem
Use a full screen dialog fragment using a ComposeView as a root, and having a standard compose layout inside. The point of course is that Compose is used.
The app only crashes if this dialog is opened immediately after app startup; if given a few extra seconds, then it does not.
The issue is not reproducible when disabling Instabug. The issue was somehow mitigated by upgrading to the latest Instabug version, but is not resolved.
Instabug integration code
Make sure to remove your app token.
SDK Version
11.4.1
Android Version
Reproducible on Android 10 device and Android 12 Emulator.