admin 管理员组文章数量: 1086019
I encountered an issue with using Coroutines Stacktrace recovery on Android. I followed official documentation but seems like Im missing something.
I enabled debug mode with System.setProperty("kotlinx.coroutines.debug", "on");
in my project's Application
class onCreate
, but it does not seem to work for me no matter what I do.
For example this code:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
runBlocking {
callerFunction1()
}
}
fun callerFunction1() {
CoroutineScope(Dispatchers.Main + CoroutineName("Caller1")).launch {
intermediateFunction1()
}
}
suspend fun intermediateFunction1() {
delay(100)
intermediateFunction3()
}
suspend fun intermediateFunction2() {
delay(100)
crashFunction()
}
will trim the stack trace only to crashFunction
call without any callers info.
Is there a chance to obtain a trace in a way: crashFunction
-> intermediateFunction2
-> intermediateFunction1
?
What I tried:
- Using Coroutine ExceptionHandler
- Using try-catch at the top level
- Using my CustomException which implements CopiableThrowable
- Using other types of exception like IllegalStateException
Environment
- Android
- Standard debug build - no Proguard or R8
- kotlin 2.0.0
- coroutinesVersion 1.8.1
本文标签: Kotlin Coroutines Stacktrace Recovery trims the suspend call stackStack Overflow
版权声明:本文标题:Kotlin Coroutines Stacktrace Recovery trims the suspend call stack - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744093239a2532427.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论