I would say it is the coil, but if you swapped it with a known good one, it would likely be something else. I would still buy a new coil, it highly unlikely a new coil will fail on you(and they do at the worst times). Cdis are rare to go bad, it does happen. This happened to me........07 ktm 250xc. It starting not running good, stalling, sputtering, barely going and finally crapped out on me. I was at a road and just got out of the sand pit, so I was lucky. I had barely any spark, so new plug, somewhat more spark. And would start and die quickly and minutes later not start at all. I called my friend to get me. Brought bike home, got a new coil....it started, but died out quickly, it had no spark. Different cdi.....no change, new wiring harness.......no change, new stator....good spark at first and ran, but no change after it ran some. I then put in a new flywheel key.......same deal as the stator. I was getting annoyed and stumped. My builder said it could be the flywheel, its very very rare. He told me to remove the flywheel, re-install it and give it a few taps with a dead blow

to seat it fully. It started after that, ran for a few and died out. I tapped the flywheel and it ran, then died out. So I ordered a new flywheel and installed it......end of any problems. The least likely thing was the problems and I wasted over $300 on things I didn't need. Swap the flywheel, your problem is likely there.