Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos Henrich <marcoshenrich@gmail.com>2016-07-05 12:46:03 +0300
committerGitHub <noreply@github.com>2016-07-05 12:46:03 +0300
commit80d015b2df275ad48fa77c02224f6ebc7e08bbd4 (patch)
tree7e67e427f35f563189ea1c21b9f42212fd2ca380
parent11e7e443997ff616493baf850306686c26cc0542 (diff)
parent992d27a8e6abb4495cb77a91466be178babbfb8a (diff)
Merge pull request #3210 from esdrubal/connectasyncUHE
[System] Fixes ConnectAsync UnhandledEx
-rw-r--r--mcs/class/System/System.Net.Sockets/Socket.cs2
-rwxr-xr-xmcs/class/System/Test/System.Net.Sockets/SocketTest.cs18
2 files changed, 19 insertions, 1 deletions
diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs
index c7576897189..07896d20138 100644
--- a/mcs/class/System/System.Net.Sockets/Socket.cs
+++ b/mcs/class/System/System.Net.Sockets/Socket.cs
@@ -1328,7 +1328,7 @@ namespace System.Net.Sockets
if (e.RemoteEndPoint == null)
throw new ArgumentNullException ("remoteEP");
- InitSocketAsyncEventArgs (e, ConnectAsyncCallback, e, SocketOperation.Connect);
+ InitSocketAsyncEventArgs (e, null, e, SocketOperation.Connect);
try {
IPAddress [] addresses;
diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
index 2b12d7019bf..f4586a253f8 100755
--- a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
+++ b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
@@ -15,6 +15,7 @@ using System.Collections;
using System.Threading;
using System.Reflection;
using System.Text.RegularExpressions;
+using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
using NUnit.Framework;
@@ -4345,6 +4346,23 @@ namespace MonoTests.System.Net.Sockets
socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 19);
}
}
+
+ [Test] // Covers 41616
+ public void ConnectAsyncUnhandledEx ()
+ {
+ var mre = new ManualResetEvent (false);
+
+ var endPoint = new IPEndPoint(0,0);
+ var socket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Unspecified);
+
+ var socketArgs = new SocketAsyncEventArgs();
+ socketArgs.RemoteEndPoint = endPoint;
+ socketArgs.Completed += (sender, e) => mre.Set ();
+
+ socket.ConnectAsync (socketArgs);
+
+ Assert.IsTrue (mre.WaitOne (1000), "ConnectedAsync timeout");
+ }
}
}