Skip to content

Commit 1e40d0b

Browse files
committed
Fix the coroutine debugger in the IDE
#2461 introduced a problem where the coroutine debugger in the IDE would crash: #2690 According to @nikita-nazarov, the coroutine debugger crashes at a point where a stack trace is already available and the IDE plugin attempts to look up every class listed in the stack trace. The new classes listed in the artificial stack frames were never loaded, as only their names were accessed. Now, we force these classes to be loaded, and it seems like the crash disappears.
1 parent cc6c41d commit 1e40d0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ internal object DebugProbesImpl {
5858
*/
5959
private val dynamicAttach = getDynamicAttach()
6060

61+
init {
62+
Class.forName("_COROUTINE._CREATION")
63+
Class.forName("_COROUTINE._BOUNDARY")
64+
}
65+
6166
@Suppress("UNCHECKED_CAST")
6267
private fun getDynamicAttach(): Function1<Boolean, Unit>? = runCatching {
6368
val clz = Class.forName("kotlinx.coroutines.debug.internal.ByteBuddyDynamicAttach")

0 commit comments

Comments
 (0)