The Trigger by Arthur C. Clarke and Michael P. Kube-McDowell.
The Trigger starts in the early to mid 21st century. A group of scientists invent, by accident, a device that detonates all nitrate-based explosive in its vicinity, thus providing good protection against most known modern conventional weapons. The first half of the book explores the reactions of society, government and the scientists themselves as the latter attempt to ensure that their invention will only be used for peaceful ends.
They were working on a "tractor beam" experiment. There were three nearly simultaneous events that happened:
'We were able to keep this in the family,' King said. 'Jack was on mobile
patrol in Number Three this morning. He was responding to the back lot
explosion and reaching for his sidearm, which was in the lockbox. He
ended up burning his hand on the cover of the box. I have a pretty good
idea what we'll find when we get that box open - it's sealed tight, with a
deadlock and probably a partial vacuum inside.'
Brohier and Horton watched silently as the split-screen images played.
There was no vehicle at the gate, no sign of any outsider. One moment
Fleet was sitting in the gatehouse, sipping a cup of coffee. Then the holster
on the guard's right hip seemed to explode in a fierce roar and a searing
gout of yellow flame. Screaming and thrashing frantically, Eric crashed
heavily into the metal security log desk, then the side wall before falling
against the door and out onto the pavement.
And, in a later review of footage of the car explosion that preceded the two events:
The camera was slowly panning the nearly-empty lot when there was a
bright flash inside a white sedan parked in the foreground. The vehicle
seemed to jump in place, the windshield and both of its passenger-side
windows blown out by a cloud of gray-black smoke that lingered over it in
the still air. Then the first tongues of flame appeared, licking at the dash.
In moments, the interior of the sedan was completely engulfed, and the
plume of smoke turned black with burning synthetics.
As it turns out, the car had fireworks (and a hidden gun) in it, followed by two incidents with guards having their guns go up, one on a lockbox and one in a holster on the guard's hip, and the explosions happened (and stopped the experiment) right away, although they don't work out exactly what happened until the next day. This doesn't match with your question entirely, but it's pretty close. Also not matching, the experiment is in a private commercial lab, not a university. Another thing that stuck out with me is that, later in the book, the Secret Service start training with quarterstaffs and crossbows since guns are out of the question.