Help with 'step in' debugging error using Cerbot

Hi everyone. Hope this is the right sub-forum for this, but I am having issues when trying debug my code via F11 (step in) while using a Cerbot device.

For the record I am totally new to Gadgeteer, and a pretty new at C#/Visual Studio as well.

I have done some debugging for this issue. Here are some things worth mentioning.

• Issue is occurring in both VS 10 C# Express and VS12 Express for Desktop, so its not particular to one version of the IDE
• Issue is happening on two different PCs, so it’s not particular to one rig
• I am using NETMF 4.3 (latest), but have also tried installing 4.2 QFE3
• Issue only happens if I create a Gadgeteer project; if I start a project with just NETMF (not same code obviously), I dont get this error
• I am able to compile and export code to Cerbot just fine (I have deployed/run several samples found on the site; I can even press F5 for a normal debug run with no issues…it is only when I hit F11 that the issue pops up
• Both loader and boot firmware for Cerbot are up to date

Okay, so here is some code and images. Whenever the error occurs, the ‘Program.generated.cs tab shows up, with a dialog box popping up asking for the following file:

C:\NetMFGadgeteer\Mainboards\GHIElectronics\FEZCerbot\Software\FEZCerbot\FEZCerbot_42\FEZCerbot_42.cs

If I close dialog, the ‘step through is stopped on the last line below of ‘Program.generated.cs:

///

This method runs automatically when the device is powered, and calls ProgramStarted.
public static void Main() {
// Important to initialize the Mainboard first
Program.Mainboard = new GHIElectronics.Gadgeteer.FEZCerbot();

I have searched my computer for this file, but cannot find it. The PATH is def wrong, because if you use default install locations, everything ends up under Program Files, not in the root of C, as this path seems to suggest.

Attached are two screens from Project options, one showing I am targeting 4.2 (even though I have 4.3 installed) and the other showing the USB Cerbot device is the target, and is visible to IDE.

Sorry for a really long first-post. Absolutely loving the idea of Gadgeteer, and cant wait to solve this first real stumbling block.

Welcome to the forum, and a great post even though it’s your first - you’ve given us great insight into your challenge.

Step into will normally take you into the code of a call. If that code is “system” code, normally in a netmf app you will automatically step over that, even though you opted to step in. Gadgeteer however is C# managed code, so you can conceivably step into that, and if you attempt to do so will actually let you.

Two options for you. Don’t do Step into on a Gadgeteer call but use Step Over instead, or alternatively you can actually download the Gadgeteer source code (Gadgeteer.codeplex.com) and install it and step-into should work.

The question would be, whether there’s an actual benefit in doing step-into when the code is not yours - so what did you expect to be able to see/do by stepping into code? I would personally just step over.

1 Like

Thank you so much for the detailed reply! I wasn’t expecting much actually :wink:

I was just digging the fact that I could step through my program, one line at a time, to see what happens in series as the program runs. I guess I misunderstood the intention of this functionality.

I have been using the Arduino IDE for some time, and it offers little-to-no debugging. I went through all the suggested tutorials on the Gadgeeter and GHI sites, and the first tutorial had me using F5 and F11 to show how debugging worked. Of course it was a NETMF project, so maybe that was why it worked without this error then.

I was hoping to see something like:

Hit F11, and see your LED Turn on. If I had debug print on next line, it would output ‘LED is On now’ after hitting F11 again. Rinse repeat with turning LED off, or any other serial action(s) in the rest of my code.

Ok, so any real Gadgeteer call (is this like using an Arduino Library?) should be stepped over. I can then get past that code. Didn’t even think to try that and will once I get home.

Once again, thanks so much for the detailed help!

F10 and F11 are your friends :slight_smile: F9 will be another one you want to get used to !

I think there’s a part of that dialog that pops up saying that you can’t find that code, just ignore it - that’s a healthy selection. The whole debug thing is great, and in your simple example like you WILL see your code turn the LED on/off and then debug output showing the message. It’s only when you hit a “complex” Gadgeteer function (like setting a LED on a LED7R module) that you could step into the code but don’t have the source by default. In the example you show, it’s about initialising the mainboard, again, the mainboard driver is something you don’t need to know about. So what I would suggest as a good first step is to put a breakpoint (f9) on the debug.print in your ProgramStarted, and hit F5 to run all the way through to that point. I’d also suggest breakpoints in your event handlers, assuming you use one of them, that way you can let the dispatcher run and not need your attention until something you actually want to watch happens.

1 Like

Worked like a champ! Thank you so much for the detailed info. Lots to learn still about .NET, but with your help I got over my first real stumbling block. Thanks again!

you’re welcome, and we’re always here to help !