Do you mean that the gun stops cycling with a mag in place (i.e. pulling the trigger has no effect on the gearbox turning over), or that once the mag is in the gun it will fire a few BBs before stopping firing any more BBs out of the barrel?
If it's the first case, then it will be a wiring or contact issue, in that no power is getting to the motor. If it's the latter case, then it may be that the inner barrel/hop unit isn't sitting exactly right in the gun, so that the mag cannot feed BBs properly. I had the latter happen to me on an M4 which I custom built from parts. For some reason, my preferred hop unit would not sit in the right place in the receiver and stopped the BBs from feeding, whereas a different hop unit, which looks identical, worked absolutely fine. It can be something as small as being a mm or 2 out of alignment which can make all the difference.
One other thing. You said you fitted a Madbull Shark hop rubber. Was this one of the blue ones? If so, they are a bit thicker than some hop rubbers and can be a very tight fit in some hop units. This means that the rubber can get distorted and not sit correctly in the hop unit, which can cause feeding issues.