The SerialPortStream object has a TraceSwitch that you can use to debug your program (or the SerialPortStream itself) if something isn't behaving as you'd expect. The name of the trace source is:
To enable tracing, add something similar to below in your App.Config file.

<?xml version="1.0" encoding="utf-8" ?>
      <source name="IO.Ports.SerialPortStream" switchValue="Verbose">
          <add name="myListener"/>
      <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="logfile.txt"/>

You should use a switchValue of Warning or less verbosity unless you are debugging your application.

Do not trace to the console. Under the Visual Studio environment, this could bring your application to a halt. Logging to a file uses much less CPU.

Last edited Dec 24, 2014 at 1:45 PM by jmcurl, version 2


No comments yet.