engine quits when gear engaged

I have a 1986 TRX 350. The engine runs fine. But occasionally, when I engage either First gear or Reverse, the engine dies. Immediately. I can restart it immediately, but the same thing happens. It runs fine, but as soon as a gear is engaged, it quits – just like turning off the key or hitting the kill switch. I’ve had it in the shop three times over the past years, and they’re as frustrated as I am. It doesn’t happen every time; maybe every 20th time or so that a gear is engaged. Frustrated!!