# Tons of problems with the debugger and Kotlin

**URL:** <https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115>\
**Category:** Support\
**Created:** [June 17, 2019, 8:09am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115 "2019-06-17T08:09:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![coder](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/coder/32/4885_2.png) [@coder](https://discuss.kotlinlang.org/u/coder)\
**Post date:** [June 17, 2019, 8:09am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/1 "2019-06-17T08:09:59Z")

</div>

I am having a ton of problems with IntelliJ debugger and Kotlin. I am running on 2019.1.3 built on May 28th.

Basically what happens is breakpoints are not detected, often IDE doesn’t stop and keeps running. Have to try a few times (rerun the app) to make it detect the breakpoints. Also, inserting new breakpoints while app is running doesn’t works. I normally run my projects delegating everything to gradle, but this happens as well when using the IDE to run the app from main class. I wonder if this is because Kotlin is relatively young or some sort of setting which I need to adjust. What do you reckon?  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/4/41a95664f2d49878d49fe20fde4dd94a2fdf5edc.png)

---

<div class="post-metadata">

**Author:** ![darksnake](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/darksnake/32/2479_2.png) [@darksnake](https://discuss.kotlinlang.org/u/darksnake)\
**Post date:** [June 17, 2019, 9:21am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/2 "2019-06-17T09:21:21Z")

</div>

This usually happens when you are using wrong version of plugin in IDEA or in build. Try to install latest plugin and then invalidate/restart.

---

<div class="post-metadata">

**Author:** ![coder](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/coder/32/4885_2.png) [@coder](https://discuss.kotlinlang.org/u/coder)\
**Post date:** [June 17, 2019, 10:12am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/3 "2019-06-17T10:12:26Z")

</div>

That’s true, for some reason plugin was stuck at 1.3.21, and not updating to 1.3.31 automatically.  
Now I have 1.3.31, which is aligned with my gradle settings as well.  
Bad news, problem is still happening. Really weird…

---

<div class="post-metadata">

**Author:** ![darksnake](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/darksnake/32/2479_2.png) [@darksnake](https://discuss.kotlinlang.org/u/darksnake)\
**Post date:** [June 17, 2019, 10:41am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/4 "2019-06-17T10:41:17Z")

</div>

Invalidate IDEA cache, rebuild project if you do not delegate build to gradle. In some cases erase `.gradle` manually.

---

<div class="post-metadata">

**Author:** ![coder](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/coder/32/4885_2.png) [@coder](https://discuss.kotlinlang.org/u/coder)\
**Post date:** [June 17, 2019, 12:38pm UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/5 "2019-06-17T12:38:33Z")

</div>

Unfortunately none of that helped… Same problem happens on different machines, also on different projects. I remember debugging was much better on version 1.2

---

<div class="post-metadata">

**Author:** ![Wasabi375](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/wasabi375/32/4741_2.png) [@Wasabi375](https://discuss.kotlinlang.org/u/Wasabi375)\
**Post date:** [June 17, 2019, 9:56pm UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/6 "2019-06-17T21:56:17Z")

</div>

Strange. I haven’t had any problems with debugging kotlin on any machine. Are you using any uncommon plugins, which could interfere with debugging? Maybe try to update or disable those.

---

<div class="post-metadata">

**Author:** ![coder](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/coder/32/4885_2.png) [@coder](https://discuss.kotlinlang.org/u/coder)\
**Post date:** [June 18, 2019, 8:36am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/7 "2019-06-18T08:36:45Z")

</div>

I disabled every plugin I could, definitely not that.  
As soon as my breakpoint is hit, this is what I see… all the rest are disabled and cannot place any new one because it’d not stop there. I am inside a suspend function and have enabled -ea like instructured here:

> <https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/debugging.md>

![image](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/b/bfe254c3fd134deaba27364b091b5d05b6625ed4.png)

Any breaktpoint I set after I click run, it will never hit.

But but but… something interesting happens if I inline that functon or change it from private to public… then it works:  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/3/385aa7e51da695d5ae4f5a788546690b3f58cbc9.png)

---

<div class="post-metadata">

**Author:** ![coder](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/coder/32/4885_2.png) [@coder](https://discuss.kotlinlang.org/u/coder)\
**Post date:** [June 20, 2019, 9:13am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/8 "2019-06-20T09:13:34Z")

</div>

I updated to Kotlin 1.3.40, problem is still there.  
I can confirm the problem happens within suspendable and private methods at the same time.  
It’s easy to reproduce:

```
suspend private fun trythis() {
        val a = 1
        val b = 2
        val c = a + b
    }

```

So this is how it behaves:

- public = works
- private = works
- suspend public = works
- **suspend private = doesn’t work**
- inline suspend private = works
- any combination with inline = works.

You have to change breakpoints after it started to reproduce, then it will happen.  
Maybe worth opening an issue?  
Happens both delegating to gradle and using internal launcher with main class.

---

<div class="post-metadata">

**Author:** ![Wasabi375](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/wasabi375/32/4741_2.png) [@Wasabi375](https://discuss.kotlinlang.org/u/Wasabi375)\
**Post date:** [June 20, 2019, 9:38am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/9 "2019-06-20T09:38:01Z")

</div>

> [@coder](#):
>
> Maybe worth opening an issue?

Definitely

---

<div class="post-metadata">

**Author:** ![coder](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/coder/32/4885_2.png) [@coder](https://discuss.kotlinlang.org/u/coder)\
**Post date:** [June 20, 2019, 10:05am UTC](https://discuss.kotlinlang.org/t/tons-of-problems-with-the-debugger-and-kotlin/13115/11 "2019-06-20T10:05:28Z")

</div>

Ok tracked here.  
[https://youtrack.jetbrains.com/issue/KT-32102](https://youtrack.jetbrains.com/issue/KT-32102)
