CoroutineExceptionHandler not executed when provided as launch context

后端 未结 2 1446
醉梦人生
醉梦人生 2021-01-05 15:04

When I run this:

fun f() = runBlocking {
    val eh = CoroutineExceptionHandler { _, e -> trace(\"exception handler: $e\") }
    val j1 = launch(eh) {
            


        
2条回答
  •  时光取名叫无心
    2021-01-05 15:43

    What is your kotlinx.coroutines version? Since 0.26.0 standalone launch builder is now deprecated and You should be using GlobalScope.launch instead.

    I tried your sample and after that change it worked.

    Kotlinx.coroutines changelog

提交回复
热议问题