jcurl / RJCP.DLL.SerialPortStream

SerialPortStream is an independent implementation of System.IO.Ports.SerialPort and SerialStream for better reliability and maintainability. Default branch is 2.x and now has support for Mono with help of a C library.
Microsoft Public License
624 stars 197 forks source link

hi in the raspberry pi Raspbian some time will write problem #63

Closed pigwing closed 6 years ago

pigwing commented 6 years ago

"stackTrace": " at RJCP.IO.Ports.SerialPortStream.WriteCheckDeviceError() \n at RJCP.IO.Ports.SerialPortStream.WriteCheck(Byte[] buffer, Int32 offset, Int32 count) \n at RJCP.IO.Ports.SerialPortStream.Write(Byte[] buffer, Int32 offset, Int32 count) in this time i must create SerialPortStream port again i create the serial port once and not close the port until app close

jcurl commented 6 years ago

For some reason the main thread died (a critical error). The system won't recover in this case. See the code here:

        private void WriteCheckDeviceError()
        {
            if (m_Buffer != null) {
                if (IsOpen && !m_NativeSerial.IsRunning) {
                    throw new System.IO.IOException("Device Error");
                }
            }
        }

You should enable tracing and look what was reported why the thread died. See the Wiki: https://github.com/jcurl/SerialPortStream/wiki/Tracing

jcurl commented 6 years ago

Didn't get further feedback so closing issue.