Never heard of anything like this. What year is the bike? While the bike starts to die can you keep it going with throttle? See if it's a power loss or a fuel loss. ECM maybe but the kickstand sensor shouldn't do any of that. Maybe bypass it to troubleshoot and eliminate that as the culprit.
This one is a tough one to explain, I think I need to go in order of the work I did to the bike... at least the stuff that could be in play.
Bought the bike, changed the levers.
Unlowered the bike, changed the wishbone back to the stock wish bone, pushed the front forks back through to lift the front. Used a kickstand from an 06 cbr, i thinkkkk... and bolted the stand piece to the bracket and sensor that was on the shortened kickstand.
Also, the same day I installed the wishbone and kickstand, I installed a PCV. The bike started and seemed to run fine, until about 5 minutes into riding the bike died and wouldn't start. I disconnected the PCV and the bike turned over. Rode home that day (last sunday) then went to VA for work.
I got back Friday and the bike didn't turn over... I have a gorilla alarm installed in the bike. I roll started the bike but the battery never charged enough to start it on its own. I trickle charged the bike then everything seemed fine. The HID's were failing to start, I figured the battery was almost gone. I changed the HID's out with some new ballasts. While riding after installing the HID's, I noticed something strange, the bike would seem to not want to idle when at low RPM, or in nuetral. I would hit the ignition, and the F1 and HESD would flicker. Turn the key off then back on and it would start up. Ended up riding home non-stop and revving like an ******* at lights to keep it from dying.
Changed the battery today and the issue still exists, I turn the bike over, idle it in neutral with the kickstand up, then when I put the kickstand down it starts to run like crap then eventually die....