Main Site Documentation

Debugging problems - Cerberus


Hello all,

I have some problems with the debugger while using some code I’ve written for the Cerberus. The code is ‘pure NETMF’ 4.2 (not Gadgeteer project). I am running Windows 7. The (very repeatable) errors are:

  1. Set a debug breakpoint somewhere in the code. Run the code in Visual Studio C# Express 2010 debugging mode. This causes the code to stop at the desired breakpoint.

  2. Go to the next line in the code using the debugger. The debugger does not go to the next line. The arrow marker disappears and the code is not executed (I tested with some debug print statements). I have to click the ‘stop’ button in the debugger to exit the debugging session. Edit: Note that the code was deployed. I am able to use the code as expected if I do not set the breakpoint. The problem here is that I can not use the debugger.

  3. Debug (and flash) board again using VS. One of two things happens. Either:

The code gets into the “The debugging target is not in an initialized state; rebooting…” mode and stays there for ~20-30 seconds. After that time it aborts and I get the following messages in the output window:

[quote]The debugging target and the debugger engine failed to initialize because of unspecified device errors.
The debugger engine thread has terminated unexpectedly with error ‘Could not reconnect to the debugging target after rebooting it.’.[/quote]


The debugger does not get that far and I get the following two popup windows messages with no error text in the output window:

[quote]TinyCLR Error: An exception occurred while attempting to launch the debugger: Object reference not set to an instance of an object.
Microsoft Visual C# 2010 Express: The operation could not be completed. Unspecified error[/quote]

I can ‘reset’ my device by flashing a fresh project to it. I can use the debugger with these fresh projects. I also tested my board with a (very) old version of my code/solution and it worked as expected as well.

I do not know what caused this issue. Today was the first time that I have seen it. I have not changed the Cerberus code in some time (repo shows January 7th), but I have been changing client-side code that interacts with the Cerberus. I am at a loss as to where to look to start solving this problem. I ran ‘Clean Solution’ and ‘Rebuild Solution’ hoping that it would help, but I see the same results. I feel that it is not NETMF/Drivers/Etc. related because I am able to deploy other projects and use the debugger as expected, but maybe I’m off-base on that one. I would guess that I somehow messed up a reference to some DLL or project while messing with my ‘client-side’ code.

Any help would be appreciated! If you need me, I’ll be over here flailing and banging my head against a wall.



I know everyone has been on the edge of their seat, so, drum roll please!!!

I was just being an idiot with my watchdog timer. The message was pretty cryptic, which made me think it was something a lot worse. I must have never ran into the problem before because I actively commented out my watchdog init/use when debugging. I threw some

// Don't init/use watchdog
// Init/use watchdog

around the watchdog and now all is fine.

Is this the ‘best practice’ for working with watchdog timers during debug sessions?



Well the watchdog timer ensures that the program isn’t hung; and it will look hung if you’re debugging it. Only turn those on after your program is complete and you’re doing integration testing.