You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While talking with a device, I pull off the cable.
The port is removed by system.
The IsConnected becomes false but the the ConnectionStatusChanged is not fired.
On closure this gets logged. (Porta chiusa = Closed port)
<ERRO> 2022-01-18 15:31:37.5691 (6792:021) [SerialPortLib.SerialPortInput.LogError] System.InvalidOperationException: Porta chiusa.
in System.IO.Ports.SerialPort.get_BytesToRead()
in SerialPortLib.SerialPortInput.ReaderTask(Object data) in C:\projects\serialport-lib-dotnet\SerialPortLib\SerialPort.cs:riga 354 System.InvalidOperationException: Porta chiusa.
in System.IO.Ports.SerialPort.get_BytesToRead()
in SerialPortLib.SerialPortInput.ReaderTask(Object data) in C:\projects\serialport-lib-dotnet\SerialPortLib\SerialPort.cs:riga 354
About each second then I get this into log. (La porta 'COM7' non esiste = The port 'COM7' does not exist)
<ERRO> 2022-01-18 15:31:39.5880 (6792:022) [SerialPortLib.SerialPortInput.LogError] System.IO.IOException: La porta 'COM7' non esiste.
in System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
in System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
in System.IO.Ports.SerialPort.Open()
in SerialPortLib.SerialPortInput.Open() in C:\projects\serialport-lib-dotnet\SerialPortLib\SerialPort.cs:riga 288 System.IO.IOException: La porta 'COM7' non esiste.
in System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
in System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
in System.IO.Ports.SerialPort.Open()
in SerialPortLib.SerialPortInput.Open() in C:\projects\serialport-lib-dotnet\SerialPortLib\SerialPort.cs:riga 288
If I put the cable back, as soon as the port is ready again the ConnectionStatusChanged gets fired for a new connection.
I'm currently using reflection to check when IsConnected == false if "connectionWatcher" field is not null and force a Disconnect().
This simple hack seems to fix the issue, but the fact I'm searching for a private field after it's name is so ugly I decided to open this issue.
Thank you for your attention.
The text was updated successfully, but these errors were encountered:
@zizzo81 Can you please tell me how you solved this problem and if you are willing to share some code snippets because I am also experiencing this problem and I am clueless at the moment. Thanks in advance.
While talking with a device, I pull off the cable.
The port is removed by system.
The IsConnected becomes false but the the ConnectionStatusChanged is not fired.
On closure this gets logged. (Porta chiusa = Closed port)
About each second then I get this into log. (La porta 'COM7' non esiste = The port 'COM7' does not exist)
If I put the cable back, as soon as the port is ready again the ConnectionStatusChanged gets fired for a new connection.
I'm currently using reflection to check when IsConnected == false if "connectionWatcher" field is not null and force a Disconnect().
This simple hack seems to fix the issue, but the fact I'm searching for a private field after it's name is so ugly I decided to open this issue.
Thank you for your attention.
The text was updated successfully, but these errors were encountered: