Is it possible that board/stm is broken but somehow it passes reflashing without problems??
I've been experiencing a similar problem over the last few days. In my case it seems if an unhandled exception happens early in the program than the board halts and I can't deploy anything to it. After that I have to reflash since resetting doesn't seem to work. I speculate that on a reset it's starting off running my program and halting before I can do another redeployment.
During development I've found it helpful to put a 4 second delay at the start of my program (via Thread.Sleep). When the board is halted I can at least reset it and have 4 seconds to get a deployment going before the problem code executes.