I don't really know the code, but FightClassWaitForRegen is run by a wow thread, afaik it is actually run by directx by a hardware break and you sleep this thread -> while (Conditions.InGameAndConnectedAndAliveAndProductStarted && !Common.IsAttackedByNpc), so assuming that the first condition is true, it will sleep the thread updating your code until Common.IsAttackedByNpc becomes true, thisway stopping the originally directx thread from doing it's original job. Guessing from the variable's name it isn't constantly true, rather occasionally. I wouldn't sleep the thread based on that.
Edit: the single step exception is actually caused by killing wrobot (the handler for the SEH exception from the hardware bp gets lost)
Edit2: Even if that code is run outside of the client, the cause of the problem might be similar.