Windows Mobile: Debugging Tip when Developing in Managed Code

If you are developing a Windows Mobile 5.0 application in C# (or even Visual Basic .NET), here’s a useful little tip for getting some information whilst your application is running.

By including the Diagnostic class – like this:

#using System.Diagnostics;

in your application, you can pepper your code with lines like this:

Debug.WriteLine(“The tricky part of the code is running”);

and display variable names and so on:

Debug.WriteLine(“And my variable X is equal to “+x);

The WriteLine statements will execute as your application runs, and their output appears in the Visual Studio window called “Output”. By default, this window appears at the bottom right of the screen, but you’ll have to select the “Output” tab.

It can be amazingly helpful to see what your program is doing without having to resort to breakpoints, or display stuff on the device’s own screen.

Comments (0)

Skip to main content