Menu

#382 Unhandled exceptions when USB port disconnected

closed-fixed
Maettu
IO (62)
8
2017-07-28
2017-07-26
Anonymous
No

If a terminal session is started to a COM port that corresponds to a USB port (i.e. a CDC device), and the USB cable is unplugged or the remote device is restarted (causing it to drop the USB connection temporarily), YAT terminates with an unhandled exception when you try to either send data or close the port. The trace in either case is:

An unhandled asynchronous non-synchronized exception occurred while running YAT.

YAT Gamma 3 Version 1.99.70

Exception:
Type: System.ObjectDisposedException
Message:
Safe handle has been closed
Source:
mscorlib
Stack:
at System.StubHelpers.StubHelpers.SafeHandleC2NHelper(Object pThis, IntPtr pCleanupWorkList)
at Microsoft.Win32.UnsafeNativeMethods.WaitCommEvent(SafeFileHandle hFile, Int32 lpEvtMask, NativeOverlapped lpOverlapped)
at System.IO.Ports.SerialStream.EventLoopRunner.WaitForCommEvent()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Discussion

  • David Crocker

    David Crocker - 2017-07-26

    I created this ticket, but SF seems to have forgotton my login status while I did so.

     
  • Maettu

    Maettu - 2017-07-28
    • labels: --> IO
    • status: unread --> open-accepted
    • assigned_to: YAT - Yet Another Terminal --> Maettu
     
  • Maettu

    Maettu - 2017-07-28

    Fixed:

    "Additional workaround applied to prevent 'ObjectDisposedException' when disconnecting USB/RS-232 converters (USB CDC) without closing the serial COM port (bug #382). Workaround also applies when undocking or hibernating a computer running YAT without closing the serial COM port, as well as when restaring devices that implement a virtual serial COM port (USB CDC)."

    Releated to former limitation:

    "Use of USB/RS-232 converters (USB CDC) while disconnect, undock or hibernate without closing the serial COM port may require to reset the converters, i.e. disconnect and reconnect them, or restart the computer. In addition, it may be required to disconnect or reset any device sending continuous data. Otherwise, the related serial COM ports may no longer be opened by an application. Issue is being reported by many users of .NET, but Microsoft seems to have no plans fixing it. If an 'ObjectDisposedException' or 'UnauthorizedAccessException' still occurs, the serial COM port connection monitoring has to be disabled in the terminal settings."

    Waiting for release of YAT 1.99.80.

     
  • Maettu

    Maettu - 2017-07-28
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.