[System] Fixes ConnectAsync UnhandledEx
authorMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 27 Jun 2016 09:00:01 +0000 (10:00 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 27 Jun 2016 09:42:05 +0000 (10:42 +0100)
commit992d27a8e6abb4495cb77a91466be178babbfb8a
tree824f6565eb0c2153bbaab5bb819d90bd53ab91c6
parenta05bc5465aa463f4f702c26c22f0312a376b337c
[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.
mcs/class/System/System.Net.Sockets/Socket.cs