Interactive Debugging


As the final step in this chapter, let's try debugging the application. Instead of pressing F5, press F10 (the shortcut for Step Over on the debug menu). Doing so will build, deploy, and launch the emulator, but you will be stepping into your code at the very same place the emulator begins execution: the entry point.

Pressing F10 again will bring you to the point just before Debug.Print() is invoked. You can hover the mouse over the string resource (String1) to see that, indeed, it is an object. With the Output window displayed, press F10 again to perform the call and watch the string appear.

Now, let's show off one feature of interactive debugging on the emulator (or on an actual device, for that matter) by repeating that last call. Right-click the line of code with Debug.Print() and select Set Next Statement from the context menu. This will move the instruction pointer back to just before the call. Pressing F10 again should result in another string being written to the Output window.

In subsequent code samples, we'll cover many more advanced techniques for debugging your applications, as well as some of the limitations and differences compared to debugging a normal Windows application. And, if all other debugging techniques fail, at least you now know how to write a message to the output console!




Embedded Programming with the Microsoft .Net Micro Framework
Embedded Programming with the Microsoft .NET Micro Framework
ISBN: 0735623651
EAN: 2147483647
Year: 2007
Pages: 118

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net