I get these all the time at the range I work. One trick I have often used.
Point the gun downrange
FIRMLY grasp the slide with overhand grip in left hand.
With the heel of your shooting hand slam it firmly into the grip while continuing to firmly gripping to the slide.
Most of the time this hard impact will safely move the slide to the rear ejecting the empty casing or live round.
The goal here is to hold the slide steady and move the frame forward with force.
NOTE: I SAID POINT THE GUN DOWNRANGE WITH NOTHING IN FRONT OF THE MUZZLE.