Safe Handle Has Been Closed Serial Port
Message='Safe handle has been closed' Source='System' ObjectName=' StackTrace: at Microsoft.Win32.UnsafeNativeMethods.WaitCommEvent(SafeFileHandle hFile, Int32& lpEvtMask, NativeOverlapped* lpOverlapped) at System.IO.Ports.SerialStream.EventLoopRunner.WaitForCommEvent(). Nov 15, 2017. I have a private function that creates a new serial port and opens it. From time to time, I get the 'Safe handle has been closed' exception, that terminates the application. Now, I've been reading a few optional fixes and would like to know from your experience, what may be the real problem in my code.
Hi Jens, This does not happen 'universally.' I just tried it with two different USB serial adapters, and I didn't get an exception. My thought is that there is something funny going on with the USB virtual serial port driver for your device. In the past (before the days of VS2005), I've had trouble with several different USB adapters, and updating the driver from the manufacturer has fixed those problems. Have you tried your device with other serial programs (non-VS2005)? Also, MS does not monitor these newsgroups. So, you have to report bugs directly (Product Feedback Center: ).
Dick -- Richard Grier, MVP Hard & Software Author of Visual Basic Programmer's Guide to Serial Communications, Fourth Edition, ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March 2006. See for details and contact information. Hi Dick, Thank you for the answer, but unfurtunally we do not regard this as a driver problem. Canon Ir3245 Scanner Driver For Windows Xp. We have a.NET 1.1 version where we use native Win32 calls, and that works fine - using the same device, cable, port and driver. Hi Jens, >>To us, this looks like SerialStream.WaitForCommEvent fails when the thread is aborted and the port has disappeared.
C# SerialPort System.ObjectDisposedException, safe handle has been closed 解决方案. Download Auden Age Of Anxiety Pdf Converter. If I use GC.SuppressFinalize(serialPort.BaseStream), it still doesn't work in my case. Although the serial port object is not disposed by GC, the serial port can't receive data yet. I find another way, and it works always! C# SerialPort System.ObjectDisposedException, safe handle has been closed 解决方案. 发布于: 2015-56-30 作者:本站编辑 来源:转载 浏览:. If I use GC.SuppressFinalize(serialPort.BaseStream), it still doesn't work in my case. Although the serial port object is.
Comments are closed.