Преглед изворни кода

[System] Fixes ConnectAsync UnhandledEx

Fixes #41616

ConnectAsyncCallback now throws an exception when called a second time.
ConnectAsync reuses SocketAsyncEventArgs in BeginConnect which
already updates its state and calls ConnectAsyncCallback.

The changes make sure that ConnectAsyncCallback no longer called on
ConnectAsync catch block, while the state is still updated with the
exception.
Marcos Henrich пре 9 година
родитељ
комит
992d27a8e6
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      mcs/class/System/System.Net.Sockets/Socket.cs

+ 1 - 1
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;