riflockle
03/24/2020, 6:11 AMandroid test
source code
// AnyTest.kt
@Test
fun callStackCrop_a() = runBlocking {
a(0)
a(1)
a(2)
a(3)
a(10)
***a(11)*** // 76 line
a(12)
}
suspend fun a(x: Int): Unit = b(x) // this action cropped....
suspend fun b(x: Int) = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
c(x) // 82 line
}
suspend fun c(x: Int) {
if (x > 10) {
throw NullPointerException("ops x = ${x} > 0") // 86 line
}
}
Test result is that
at ___.AnyTest.c(AnyTest.kt:86)
at ___.AnyTest$b$2.invokeSuspend(AnyTest.kt:82)
at |b|b|b(Coroutine boundary.|b(|b)
at ___.AnyTest$koroChase$1.invokeSuspend(AnyTest.kt:76)
Caused by: java.lang.NullPointerException: ops x = 11 > 0
at ___.AnyTest.c(AnyTest.kt:86)
at ___.AnyTest$b$2.invokeSuspend(AnyTest.kt:82)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)
"Calling b() method
at a()
" is removed…..
I want to see all call stack trace
in coroutine
how to recover this call stack.....?
Attach a link with a similar problem
https://github.com/Kotlin/kotlinx.coroutines/issues/1660Zach Klippenstein (he/him) [MOD]
03/24/2020, 2:41 PMriflockle
03/24/2020, 11:35 PM