mono/mono — pull request #283 by robwilkens (2012-05-01 17:19:37+00:00)
Title: Bug #4796- fix: Mono.Data.Tds.Protocol.TdsConnectionPool.GetConnection() needs to have result set to null before looping back with goto

See Reported Bug #4786 in bugzilla which this attempts to resolve (and seems to succesfully). This was an error with Open() on System.Data.SqlClient.SqlConnection raising unexpected exception on failure to log in on 2nd attempt and beyond with invalid password/username.

This is a one line change: result = null; had to be set before going back to the 'retry' point in GetConnection..

This is/should-be safe because we had just disconnected result a few lines earlier.

Without this change, under certain conditions which would flag a retry, when it went to the retry point it wouldn't reset 'result', and as a result the main loop at the top of the GetConnection() function would be skipped (it has -- while (result == null) -- at the retry point, and it would always be not null when it reached that on retry), after which point it would just continue to retry on the same result indefinitely, which would eventually result in an exception being raised.