Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

I/O Exception Serialport.datareceived VB.NET 4

$
0
0

I get an I/O exception when I run serialport.close() "The I/O operation has been aborted because of either a thread exit or an application request". The exception comes from the datareceived event. I don't want this exception, can anyone tell me how to get rid of it. I have tried Removehandler and sleep before calling close(), but nothing seems to help. In my datareceived procedure I have;

if SerialPort1.IsOpen then

Try

         readBuffer = SerialPort1.ReadLine()

         Me.BeginInvoke(New EventHandler(Addressof DoUpDate))

Catch Ex as Exception

          MsgBox(ex.message)

End Try

End If

I am sure that the exception comes from the ReadLine() statement when I try to close the serialport with serialport1.close. Thank you in advance for your help.


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>