In fact, if you're taxing your MacBook Pro, the battery may still discharge even though it's connected to the power supply, but it will discharge a lot slower.
The power supply will get HOT. I've had one shut down on me temporarily, a couple of years ago.
In a pinch, you can do it. I'd sleep it to charge, but that's just me.