[Mono-bugs] [Bug 384227] New: On Mac OS X, System.IO.Ports. SerialPort cannot read data using any Read* method.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 28 01:11:08 EDT 2008


           Summary: On Mac OS X, System.IO.Ports.SerialPort cannot read data
                    using any Read* method.
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: Blocker
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: cwalker at controlthink.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner

Chris Walker <cwalker at controlthink.com> changed:

           What    |Removed                                         |Added
               Flag|                                                |SHIP_STOPPER?, CCB_Review?

Under Mac OS X, a simple Mono application is created to open a serial port,
watch for available data, and then read that data.

Whenever the .Read(...), .ReadByte(), or even .SerialBase.Read(...) methods are
called, Mono throws a TimeoutException.  It is impossible to read data from the
serial port.

More details:
If the .ReadTimeout property is set to 1, 400, 4000, 40000, or Infinite, the
TimeoutException is still thrown.  It is thrown pretty much immediately.  This
happens even when .BytesToRead is showing hundreds of bytes available.
This has been tested with both a USB adapter (Socket Bluetooth Serial Adapter)
and a Serial adapter (Socket USB Serial Adapter).

Expected behavior:
At least one of the .Read* function calls should read data.

Sample code:
---8<------8<--- Sample code --->8--->8---
using System.IO.Ports;
SerialPort serialPort = new SerialPort("/dev/tty.usbserial-SC51BZ99", 115200);

// NOTE: it doesn't matter what this value is set to or if it set...
serialPort.ReadTimeout = SerialPort.InfiniteTimeout;

while (true)
    int bytesToRead = m_SerialPort.BytesToRead;
    if (bytesToRead > 0)
            int value = serialPort.ReadByte();
            Console.WriteLine("value: " + value.ToString()); // we never get
        catch (TimeoutException ex)
            // our Read call _always_ throws a TimeoutException
            Console.Write("Impossible!  We just timed out with
---8<------8<--- End sample --->8--->8---

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list