Years ago (many years, Glock 36's were just coming out), I purchased a new G36.
Took it to the range and had many, many instances of the slide locking back with ammo still in the magazine.
Trouble shooting the problem showed that it had the WRONG slide stop lever installed. The G36 had a 9mm-gun slide stop lever installed.
The tab on the 9MM (G17, G19, G26, et cetera) slide stop lever stuck out just far enough into the operating envelope of the incoming round from the mag that sometimes that round "tripped" the lever and pre-maturely locked the slide open.
The way to check for this is to field strip the gun and insert a loaded mag into the grip frame. Check to see if the small tab on the slide stop lever is sticking out into the operating envelope of the incoming round.
This is what the problem lever looked like - you can see where the tab will get in the way of the round being loaded.
And this is what the solution looked like (I reshaped the tab to clear the incoming round).
You can also use this modification of the tab to make a 9MM Extended slide stop lever function in a G36. (Glock does not have a Extended slide stop lever to fit the G36. All the ones you see for sale on the various Websites are 9MM levers that have been modified.)