Debugging in VS after hot reload

My question is rather simple:

Is it possible?

As already mentioned in How can i debug with vs2017 after hot reload - Debugging, Optimization, & Profiling - Unreal Engine Forums
Visual Studio (in my case VS2017) cannot attach to a newly built and loaded DLL.

Is it a known bug with VS and therefore an inherent limitation, or is there any workaround (some VS settings probably)?

How to reproduce:

  1. Start VS2017
  2. Select “DebugGame Editor” config
  3. Start debugging (F5)
  4. Place breakpoint (for example at BeginPlay() in an actor)
  5. PIE → breakpoint is hit
  6. Detach VS debugger (Debug/Detach All)
  7. Make some changes to the code
  8. Build game project
  9. Observe the editor to Hot Reload the new DLL(s) (BuildTool should detect UE running and choose compiling for hot reload)
  10. Reattach VS debugger (Debug/Reattach to Process)
  11. PIE → breakpoint is not hit

To me it seems that VS debugger cannot find out that the editor is now using a new DLL,
or Unreal Editor behaves like it still uses the old DLL (‘Modules’ window shows the old DLL to be loaded).

It was possible before. Stopped working in 4.20 it seems as I have the same issue after upgrading the project to the new engine version.

Don’t use Hot Reload. It creates weird side effects that can create confusion. Close the editor each time you need to recompile your project.

I had the same issue when i switched engine version. I fixed it by switching back to 4.19 and then to 4.20 again.

That’s interesting. Have you done something specific during that back and forth switch? Like wiping Binaries. Intermediate, and Saved folders? I’m using a source code build of the engine so going back and forth is not that easy.

Yes,I manually removed both Binaries and intermediate folders and regenerated project files.

Thanks for confirming that. I’ll see if just that is enough to solve this.

I use it all the time. I’m doing fine. And it helps iteration times enormously.

Try it, use it, and see if it works for you.