There may be a switch on the side stand, which closes when the stand is up; if the stand is down, most modern bikes will stop running when put in gear. It may just need a good cleaning. BTW, what light?
Like WintrSol said, your side stand switch might need attention.
The rod on the switch is in the "in" position when the stand is down. When the stand is up the rod on the switch moves to the "out" position.
Yours may not be moving out when you put the stand up. The switch is mounted near/at the stand pivot.
I used to know a guy that had to pull the rod out every time he wanted to ride the bike... Said it was his theft prevention device.... Lol
And yeah, what light?
There are variations, but many newer bikes run the neutral and side-stand switches in a semi-parallel setup, so that either the neutral light must be on, or the side-stand up, to keep the engine running. I guess that's so you don't ride off with the stand down (read: lawyers). I have, once or twice, done this on my old CB450, and it is literally and figuratively unsettling in the first left turn.
My Valkyrie has a side-stand down light, too, but that bulb doesn't provide the Voltage pull-up for the ignition to see when the stand is up. Perhaps if this bulb does pull up the input to the OP's bike ignition, it would die the way he describes it. The Suzuki Intruder/Boulevard I had used it to turn on a relay, and that relay failed sometimes, but the switch was always the first suspect.