Using System.Diagnostics

  • Thread starter Thread starter Will Chapman
  • Start date Start date
W

Will Chapman

I found the following example on MSDN but
when I try to run it in CF I get a load of
errors:

using System;
using System.Diagnostics;

class Test
{
static void Main()
{
Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
Trace.AutoFlush = true;
Trace.Indent();
Trace.WriteLine("Entering Main");
Console.WriteLine("Hello World.");
Trace.WriteLine("Exiting Main");
Trace.Unindent();
}
}
Typical errors are:

error CS0117: 'System.Diagnostics.Trace' does not contain a definition
for 'AutoFlush


Any ideas what I am missing?

Thanks

Will Chapman
 
You're not missing anything. CF doesn't support the full range of Trace
functions.

OpenNETCF's SDF does implement a TextWriterTraceListener class that I've
used in a few projects, so I know it works.

-Chris
 
You're not missing anything. CF doesn't support the full range of Trace
functions.

That would explain it! However, the Version Information on the MSDN page
that offered this code implies that it is available for both full and
compact frameworks v1 and 2.

http://msdn2.microsoft.com/en-us/library/system.diagnostics.trace(VS.80).aspx

OpenNETCF's SDF does implement a TextWriterTraceListener class that I've
used in a few projects, so I know it works.

I'll check that out. What I'm looking for is sample code (or 3rd party
tool) for tracing/profiling smart device apps. Do you know of anything?

Cheers


Will
 
Back
Top