Hi!
I’m very familiar with the behavior you mention. Visual studio will absolutely lie to you about things when breaking through code if running in development mode. Lots of things tend to get optimized away and it isn’t generally clear what changes have been made. However - and I have a lot of time around this behavior - it won’t actually change the end result of what your code does or how it behaves. At least, I’ve never seen it change the actual functionality in my years programming in unreal and VS. But you cant trust your break points or watches or your breaking through code. So I personally never run in development mode. I always run DebugGame Editor. That way I know that my code is not being optimized away. However, even in DebugGame Editor, the engine code will be optimized away. Running in Debug Editor is too slow for me so if I have to debug engine code, I always add the pragma deoptimize around the engine code so VS doesn’t lie to me.
Related reading about the different build configurations: Build Configurations Reference | Unreal Engine Documentation