VS 2015 Breakpoints just not working after 4.21

I have been working on my project in 4.17 for a while. However, recently I upgraded to 4.19, and then again to 4.21 soon after that.

For some reason, in both these versions VS debugging is just jerking me around in ways that it didn’t in 4.17.

What I do is “Attach To Process” (ctrl + alt + P) to attach VS to the running UE4 editor. Then I hit a breakpoint. Sometimes the breakpoint doesn’t work because, supposedly, the editor is not up to date with my latest build (even though that’s patently wrong; I just compiled from VS and saw the hot reload working on the editor with the accompanying chirping sound). So I have to close my editor and open it again.

Then, when the editor is open and the breakpoint is hitting correctly, and I re-attached the process, the debugger simply doesn’t stop where I placed the breakpoint. Even though I know the code is running where I hit the breakpoint.

In fact, what happens is that the debugging only works for some of my classes, but not all of them. I could, for example, put a breakpoint in a function in class A, where I know the debugging will work, and get to the debugging screen I desire. Then I can watch as it calls a function from class B. However, if I go to that exact function in class B and put a breakpoint there and run again, the debugger will simply skip that portion, but the code will run.

To get it to work in the specific class and function in which I want it to work, I have to close and open the editor again and re-attach it. Sometimes I have to do it multiple times. I have had to close and open and re-attach the editor 3 times for both the breakpoint to set, and for the debugger to actually stop at the breakpoint when the function runs.

I have no idea why this is happening. It never happened to me in 4.17. I was always able to debug seamlessly. I have had to do a lot of mental tracing through my code to figure out what’s going on, because the debugger just won’t let me actually trace the code. Does anybody know why this is happening in the newer versions?

I have the same problem. Attaching VS while the Editor is already running doesn’t work properly (as described above, breakpoints are not hit). Breakpoints are only hit when I start the editor from VS via run. Another symptom is that the diagnostic tools aren’t working when I attach (showing nothing). This is happening on a new UE 4.21 project, it never happened on 4.18 or 4.15.