Bug 26891 - Bug in Socket.ConnectAsync Disposal
Summary: Bug in Socket.ConnectAsync Disposal
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-02-09 21:04 UTC by Craig
Modified: 2016-04-16 09:10 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Craig 2015-02-09 21:04:02 UTC
The following code will cause an unhandled exception after about 30 seconds.  It seems that the connection attempt continues even after the socket is closed.  I've compared this vs. standard Microsoft .NET implementation and the standard implementation doesn't throw an error.

using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))

           //Simulate Socket Async Connection
           var e = new SocketAsyncEventArgs();
           e.RemoteEndPoint = new DnsEndPoint(host, port);

           //Simulate aborting connection before fully connected
           //Useful if you want to implement a timeout

Note You need to log in before you can comment on or make changes to this bug.