# A recompile is triggered in Visual Studio and this disconnects the debugger

**URL:** <https://community.coherence.io/t/a-recompile-is-triggered-in-visual-studio-and-this-disconnects-the-debugger/801>\
**Category:** Bug reports\
**Created:** [March 31, 2026, 8:34am UTC](https://community.coherence.io/t/a-recompile-is-triggered-in-visual-studio-and-this-disconnects-the-debugger/801 "2026-03-31T08:34:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![owda](https://avatars.discourse-cdn.com/v4/letter/o/90ced4/32.png) [@owda](https://community.coherence.io/u/owda)\
**Post date:** [March 31, 2026, 8:34am UTC](https://community.coherence.io/t/a-recompile-is-triggered-in-visual-studio-and-this-disconnects-the-debugger/801/1 "2026-03-31T08:34:50Z")

</div>

(Please make the title of your topic brief but informative, and post error messages under the next heading _Details and error message(s)_)

## Description, details and error message(s)

_Our code team usually stays attached to the debugger whilst coding and running the game and, whilst there can be a performance hit, this generally works fine. For some reason, these intermittent re-compiles change focus to the Visual Studio Output window (as if we’ve hit build or rebuild) and the debugger is detached from Unity. This can happen after hitting play mode, perhaps caused by a domain reload, which means we get detached without realising and then miss the break points we’re hoping to hit._

## Expected behaviour

_The code should not randomly recompile and if it does, it should not detach the debugger._

## Screenshots

_If applicable, add screenshots to help explain the problem._

## How to reproduce

**Rate: (Choose one, or describe it yourself)**  
_Once / Sometimes / Every time_

**Steps:**

1. step
2. step

## Environment

SDK:  
Unity:  
OS/Platform:

---

<div class="post-metadata">

**Author:** ![Filip](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/filip/32/142_2.png) [@Filip](https://community.coherence.io/u/Filip)\
**Post date:** [March 31, 2026, 9:21am UTC](https://community.coherence.io/t/a-recompile-is-triggered-in-visual-studio-and-this-disconnects-the-debugger/801/2 "2026-03-31T09:21:55Z")

</div>

Hey!

Do you perhaps have the “Bake on enter play mode” enabled in the coherence settings?  
 ![image](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/a56e7494fc93f3dff933d1467c0573615d22911f.png)

Other than that we’re not initiating recompilation automatically.

---

<div class="post-metadata">

**Author:** ![owda](https://avatars.discourse-cdn.com/v4/letter/o/90ced4/32.png) [@owda](https://community.coherence.io/u/owda)\
**Post date:** [March 31, 2026, 11:38am UTC](https://community.coherence.io/t/a-recompile-is-triggered-in-visual-studio-and-this-disconnects-the-debugger/801/3 "2026-03-31T11:38:52Z")

</div>

Hi Filip,

No I don’t have that setting enabled

---

<div class="post-metadata">

**Author:** ![owda](https://avatars.discourse-cdn.com/v4/letter/o/90ced4/32.png) [@owda](https://community.coherence.io/u/owda)\
**Post date:** [May 19, 2026, 11:07am UTC](https://community.coherence.io/t/a-recompile-is-triggered-in-visual-studio-and-this-disconnects-the-debugger/801/4 "2026-05-19T11:07:04Z")

</div>

Hi Filip, we’re still experiencing this issue. I’ve just spotted this error message in the output window in Visual Studio which may be relevant:

> System.ObjectDisposedException: Cannot access a disposed object.  
> Object name: ‘The ThreadLocal object has been disposed.’.  
> at System.Threading.ThreadLocal`1[T].GetValueSlow () [0x00014] in <1eb9db207454431c84a47bcd81e79c37>:0 at System.Threading.ThreadLocal`1[T].get\_Value () [0x0003e] in \<1eb9db207454431c84a47bcd81e79c37\>:0  
> at Coherence.Log.Targets.UnityConsoleTarget.Log (Coherence.Log.LogLevel level, System.String message, System.ValueTuple`2[System.String,System.Object][] args, Coherence.Log.Logger logger) [0x00001] in .\Library\PackageCache\io.coherence.sdk@38b0585e01e1\Coherence.Log\LogTargets\UnityConsoleTarget.cs:75 at Coherence.Log.Logger.LogToTargets (System.Collections.Generic.IEnumerable`1[T] targets, Coherence.Log.LogLevel level, System.String log, System.ValueTuple`2[System.String,System.Object][] args) [0x00036] in .\Library\PackageCache\io.coherence.sdk@38b0585e01e1\Coherence.Log\Logger.cs:102 at Coherence.Log.Logger.BuildAndPrintLog (Coherence.Log.LogLevel level, System.String log, System.ValueTuple`2[System.String,System.Object] args) [0x00001] in .\Library\PackageCache\io.coherence.sdk@38b0585e01e1\Coherence.Log\Logger.cs:82  
> at Coherence.Log.Logger.LogImpl (Coherence.Log.LogLevel level, System.String log, System.ValueTuple`2[System.String,System.Object][] args) [0x00078] in .\Library\PackageCache\io.coherence.sdk@38b0585e01e1\Coherence.Log\Logger.cs:293 at Coherence.Log.Logger.Warning (Coherence.Log.Warning id, System.String msg, System.ValueTuple`2[System.String,System.Object] args) [0x00010] in .\Library\PackageCache\io.coherence.sdk@38b0585e01e1\Coherence.Log\Logger.cs:218  
> at Coherence.Log.UnityLogger.Warning (Coherence.Log.Warning id, System.String msg, System.ValueTuple`2[System.String,System.Object] args) [0x00010] in .\Library\PackageCache\io.coherence.sdk@38b0585e01e1\Coherence.Log\UnityLogger.cs:110  
> at Coherence.Cloud.RequestFactory.Finalize () [0x00032] in .\Library\PackageCache\io.coherence.sdk@38b0585e01e1\Coherence.Runtime\Cloud\Requests\RequestFactory.cs:108

---

<div class="post-metadata">

**Author:** ![owda](https://avatars.discourse-cdn.com/v4/letter/o/90ced4/32.png) [@owda](https://community.coherence.io/u/owda)\
**Post date:** [August 21, 2026, 4:09pm UTC](https://community.coherence.io/t/a-recompile-is-triggered-in-visual-studio-and-this-disconnects-the-debugger/801/5 "2026-08-21T16:09:05Z")

</div>

I think 2.2 has fixed this issue 👍
