// The lock here is to protect against the command.cancel / connection.close
race condition // The SqlInternalConnectionTds is set to OpenBusy during close, once this
happens the cast below will fail and // the command will no longer be cancelable. It might be desirable to be
able to cancel the close opperation, but this is // outside of the scope of Whidbey RTM. See (SqlCommand::Cancel) for other
lock. lock (InnerConnection) { InnerConnection.CloseConnection(this, ConnectionFactory); } // does not require GC.KeepAlive(this) because of OnStateChange