ivan.savytskyi
03/25/2021, 1:36 PMthrowable.stackTraceToString()
. But calling this API crashes with ncorrectDereferenceException: Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread
exception and from stack trace of crash on iOS looks like it happens inside Throwable:
#16 0x000000010fb50ffa in kfun:kotlin.Throwable.<init>$lambda-0#internal at /Users/teamcity/buildAgent/work/f01984a9f5203417/runtime/src/main/kotlin/kotlin/Throwable.kt:33
#17 0x000000010fb511ef in kfun:kotlin.Throwable.$<init>$lambda-0$FUNCTION_REFERENCE$119.invoke#internal at /Users/teamcity/buildAgent/work/f01984a9f5203417/runtime/src/main/kotlin/kotlin/Throwable.kt:32
#18 0x000000010fb7e907 in kfun:kotlin.native.concurrent.FreezeAwareLazyImpl.getOrInit#internal at /Users/teamcity/buildAgent/work/f01984a9f5203417/runtime/src/main/kotlin/kotlin/native/concurrent/Lazy.kt:28
#19 0x000000010fb7f0b0 in kfun:kotlin.native.concurrent.FreezeAwareLazyImpl#<get-value>(){}1:0 at /Users/teamcity/buildAgent/work/f01984a9f5203417/runtime/src/main/kotlin/kotlin/native/concurrent/Lazy.kt:55
#20 0x000000010fb4e975 in getValue [inlined] at /Users/teamcity/buildAgent/work/f01984a9f5203417/backend.native/build/stdlib/kotlin/util/Lazy.kt:44
#21 0x000000010fb4e93f in kfun:kotlin.Throwable.<get-stackTraceStrings>#internal at
Did anyone run into this as well?
Also just ran quick test by doing this val tmp = RuntimeException().getStackTrace()
it crashes as wellBenoît
03/25/2021, 5:46 PMThrowable
before calling stackTraceToString()
import kotlin.native.concurrent.freeze
If you are in commonMain, then you can always create an actual/expect for this freeze()
function and just have one that does nothing for other targetsivan.savytskyi
03/25/2021, 6:04 PMBenoît
03/25/2021, 6:18 PMivan.savytskyi
03/25/2021, 7:33 PMBenoît
03/25/2021, 7:58 PMivan.savytskyi
03/25/2021, 8:08 PMRuntimeException().freeze().printStackTrace()