The following condition can be false:

Uri.TryCreate (onDemandSock, UriKind.Absolute, out uri))

which leaves output parameter "socket" unassigned. Compiler is right :-)