Cobra 2 need reflash firmware after power off/on

Hi All! I’m use FEZ Cobra 2 for home automation and all works fine.
But sometimes when power on board is off and on, or i update the program on it, the program does not start and Cobra 2 stop responding to pc by usb. Helps only firmware reflash. But after a while (power off and on) all repeats. And this happens on both FEZ Cobra 2 boards, so defects are excluded.
It does not happen very often, but I would like to find out what the problem is

Please Help.

It might be your application.

If under some special conditions your app uses 100% system resources
like an

   // empty loop

Then the debugger can not connect to your device anymore (or only by luck).

The workaround for above situation is to start deploy and the right away reset the board.
VS will connect before the app is running and deploy normally.

All this is true, but strange that pc not even defines it as a device, reporting that usb device is not recognized. Seem that boot loader in g120 not started … Can this happen due power surges ?

@ alwin - What do you mean by boot loader?

If boot up time is not critical then add Thread.Sleep(5000) as the first line of code. That garentees you a bit of time for the debugger to connect. Also you can hold down reset, click build in VS then release reset. This seems to work for me.

Boot loader i mean, code on controller that give PC to determine usb controller device. I think that controller stuck before program execution and not response to PC, reconnection not help me, only reflash solve this problem. I don’t know technically how this is work but sometimes controller after reflash program refuses to be determined by PC.
PS. Sorry for my bad english

Thanks for the advice I’ll try do it.