I'm not sure where to ask this, so apologies if th...
# coroutines
x
I'm not sure where to ask this, so apologies if this is not the right channel. I'm asking here because my Googling suggested that this issue may somehow be coroutine related. I'm trying to debug some code in a suspend function (which happens to be part of a kotest spec), and I need to see the value of a variable,
messages
. However, IntelliJ is saying "'messages was optimised out". This is despite the fact that my code uses this the variable after the breakpoint.
Copy code
val messages = msg.messages()
println(messages)                  // breakpoint is on this line
messages.size shouldBe 1
Is there any way to tell it to not optimize out a variable?
x
Thank you! Summary for anyone else finding this thread: Enable
-Xdebug
like so...
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions.freeCompilerArgs += "-Xdebug"
}
...but never use this flag in production as it can cause memory leaks.