If you don't specify command line arguments, Godot will launch in
Project Manager mode. When you launch a project from there, it closes, which makes the debugger detach.
If you want to debug the editor or a game straight away, you should change the execution directory to be your project's directory, and add command line arguments, as explained here: https://docs.godotengine.org/en/stable/development/cpp/introduction_to_godot_development.html#debugging-the-editor-with-gdb
(it says "GDB" but it's the same with Visual Studio, there is a project settings option that lets you specify those arguments).
-e will make Godot run in editor mode. Omitting it will run the game from its main scene.
If the game has no main scene, or if you want to run a particular scene, add its relative path to the command line, like
I don't know if the doc has a section explicitely showing that for Visual Studio, but here is how it looks like in QtCreator for debugging the editor on a project: