SignalR/SignalR — pull request #1683 by halter73 (2013-03-13 05:01:44+00:00)
Title: Fix for #1650

When Negotiate failed, Disconnect was called after _connectTask completed

- This meant that Stop could capture the _stateLock before Disconnect causing
HttpBasedTransport.Abort to throw an ArgumentNullException since the
ConnectionToken wasn't set.
- By making the Task returned by ContinueWithNotComplete only trigger after
its Action has executed synchronously, we ensure that Disconnect is fired
before Stop when Negotiate fails.

If Stop was called after the C# client entered the connecting state,
but before _connectTask was set the the result of Negotiate,
HttpBasedTransport.Abort would throw an ArgumentNullException since
_connectTask would complete immediately and Abort would be called before
Negotiate could set the ConnectionToken.

- Fixed by creating a _startLock forcing the _connectTask to be set to its
final value by the time Stop executes while in the connecting state.

#1650