Editor Stuck at "UnitySynchronization.ExecuteTasks"

###The problem

Every time I exit play mode, after some seconds, Unity Editor blocks and shows the following window:

It’s been like this for over 2 hours, as it can be seen in the image.

###What I Have Tried

  • Restarting (more that twice)
  • Downloading a different version of Unity and converting the project (was on 2020.3.5f1 and it’s now on 2020.3.25f1)

Neither one solved the issue and I did not find anything online about “UnitySynchronization.ExecuteTasks”.

###My Assumptions

I’m not sure what could have caused it. It seems like it started almost at the same time as I was starting to implement user reports and accessed Unity Dashboard. Maybe it’s trying do sync to something online?

I’m pretty sure it’s related to the project and not directly with the Editor, since installing another version did nothing. Maybe deleting some kind of cache would fix this, but I’m not sure what to delete.

Thankful for any suggestions as this is preventing me from working on this project.

Turns out the issue was in my code.

The message shown in the window wasn’t always “UnitySynchronization.ExecuteTasks” so I suspected Unity was getting stuck somewhere at random points, which was true.

I used Visual Studio to Attach a debugger to Unity and found it to be stuck at an infinite loop that was caused by an async method I wrote that continues to run after Unity exits play mode. After I fixed the code, everything went back to normal.

Should definitely have tried this before asking the question. Anyway, I hope this at least helps someone with a similar problem.