G
Guest
Anyone had this problem? It seems IO.Ports.SerialPort generates an "The I/O
operation has been aborted because of either a thread exit or an application
request" exception if you try to close it when it's receiving lots of data.
The following VB.Net console program reliably fails if there's a device
sending full speed serial data at it. It works fine if the data is being
sent more slowly. (less often)
---------------------------------------------
Imports System.Threading
Imports System.IO.Ports
Module Module1
Sub Main()
Dim comPort As System.IO.Ports.SerialPort
Console.WriteLine("Creating new serial port")
comPort = New IO.Ports.SerialPort("COM1", 9600, Parity.None, 8,
StopBits.One)
Console.WriteLine("Opening")
comPort.Open()
Thread.Sleep(1000)
Console.WriteLine("Closing")
'The following line often fails with: The I/O operation has been
aborted because of either a thread exit or an application request.
comPort.Close()
End Module
operation has been aborted because of either a thread exit or an application
request" exception if you try to close it when it's receiving lots of data.
The following VB.Net console program reliably fails if there's a device
sending full speed serial data at it. It works fine if the data is being
sent more slowly. (less often)
---------------------------------------------
Imports System.Threading
Imports System.IO.Ports
Module Module1
Sub Main()
Dim comPort As System.IO.Ports.SerialPort
Console.WriteLine("Creating new serial port")
comPort = New IO.Ports.SerialPort("COM1", 9600, Parity.None, 8,
StopBits.One)
Console.WriteLine("Opening")
comPort.Open()
Thread.Sleep(1000)
Console.WriteLine("Closing")
'The following line often fails with: The I/O operation has been
aborted because of either a thread exit or an application request.
comPort.Close()
End Module