Unity 2021.3.01f LTS Visual Studio 2022 Attach debugger takes very long

I use Visual Studio (the full version, not Code) with Unity, I have the latest version of the VS integration in the package manager, but I have issues with the debugger.

Steps:

  • I press play to assure that everything works
  • I stop play mode
  • I open Visual Studio and press Attach Debugger (without changing any code after the previous play!)
  • I change back to Unity and press play
  • Hold dialog opens which takes over 1 minute until the play mode and debugger finally start
    (the dialog has different messages, but most of the time it just says “Entering play mode”

This is after upgrading to Unity 2021.3.01f LTS, using the very same project with Unity 2020 LTS the debugger attaches directly without any long wait times.

Did anyone else notice this long wait dialog after attaching a debugger?

Is there any way to “fix” this, because waiting over 1 minute every time must be a bug when it only took a few seconds in the previous version.

I have the same thing in Unity version 2021.1.16.f1

I fixed this problem by unchecking all dependencies in the Preferences tab

It turns out that there are many local projects and dependencies on Unity in my project. Unity DOTS, Entities, Mathematics, VRM and others, he generated their dependencies in VS and because of this, when debugging began, he reassembled all these projects every time, as a result, the engine seeing changes in all projects hung for 10 minutes to connect each dependency to his debugger)