We have an intermittent problem using async methods connecting to a particular FTP site.
The connection is initiated, however if no response is received from the server within the timeout period an ObjectDisposedException is logged to the LogWriter, but no exception is raised so our code continues and tries to login and transfer files (resulting in an exception but later in the code).
2019-12-04 23:12:47.196 INFO FileTransferClient(2152)[32] Info: Connecting to ftp.site.com:21 using Ftp.
2019-12-04 23:12:47.196 INFO FileTransferClient(2152)[32] Info: Assembly: Rebex.Ftp 2019 R4 for .NET Standard 2.0
2019-12-04 23:12:47.196 INFO FileTransferClient(2152)[32] Info: Platform: Linux 4.15.0-1063-azure #68-Ubuntu SMP Fri Nov 8 09:30:20 UTC 2019 64-bit; CLR: .NET Core 2.x (28207.03)
2019-12-04 23:12:47.196 INFO FileTransferClient(2152)[32] Info: Using proxy none.
2019-12-04 23:13:47.988 ERROR FileTransferClient(2152)[32] Info: System.ObjectDisposedException: Safe handle has been closed at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success) at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success) at Interop.Sys.TryChangeSocketEventRegistration(IntPtr port, SafeHandle socket, SocketEvents currentEvents, SocketEvents newEvents, IntPtr data) at System.Net.Sockets.SocketAsyncContext.Register() at System.Net.Sockets.SocketAsyncContext.OperationQueue`1.StartAsyncOperation(SocketAsyncContext context, TOperation operation, Int32 observedSequenceNumber) at System.Net.Sockets.SocketAsyncContext.PerformSyncOperation[TOperation](OperationQueue`1& queue, TOperation operation, Int32 timeout, Int32 observedSequenceNumber) at System.Net.Sockets.SocketAsyncContext.Connect(Byte[] socketAddress, Int32 socketAddressLen) at System.Net.Sockets.SocketPal.Connect(SafeCloseSocket handle, Byte[] socketAddress, Int32 socketAddressLen) at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Connect(EndPoint remoteEP) at qsqr.hlec(IPEndPoint qn) at qsqt.vtgm(EndPoint eyu) at Rebex.Net.ProxySocket.Connect(EndPoint remoteEP) at rliq..ctor(Ftp acm, String acn, Int32 aco) at Rebex.Net.Ftp.dbjz(String ez, Int32 fa, TlsParameters fb, SslMode fc, FtpSecureUpgradeType fd)
Is this a known issue or does somebody have example code for detecting this scenario?
Thanks
Ian