Fix GUID parse error breaking some on-prem connections (#654)

* Fix GUID parse error breaking on-prem connections
- Fixes https://github.com/Microsoft/sqlopsstudio/issues/1896
- Verified this is only used in retry logic on Azure, so the fact it's failing on-prem isn't relevant. It's still unclear why in some cases the session ID is non-null but not a GUID.

* Added back logging if parse of the GUID fails
This commit is contained in:
Kevin Cunnane
2018-07-11 09:27:41 -07:00
committed by GitHub
parent 4ac0ae87ee
commit ebaec9c319

View File

@@ -434,12 +434,15 @@ SET NUMERIC_ROUNDABORT OFF;";
if (DBNull.Value != result)
{
string sessionId = (string)command.ExecuteScalar();
_azureSessionId = new Guid(sessionId);
if (!Guid.TryParse(sessionId, out _azureSessionId))
{
Logger.Write(LogLevel.Error, Resources.UnableToRetrieveAzureSessionId);
}
}
}
}
}
catch (SqlException exception)
catch (Exception exception)
{
Logger.Write(LogLevel.Error, Resources.UnableToRetrieveAzureSessionId + exception.ToString());
}