I have the following line of code to return a secret from a KeyVault
string kvSecret = kVClient.GetSecretAsync(azureKeyVaultUrl, secret).Result.Value;
While this works as expected, I don't really know well how the Result.Value synchronous execution handles runtime errors, exceptions, etc.
I am trying to understand if there is any possibility when I call Result.Value where there is an error and the value returned is not actually the secret but some random error therefore my variable kvSecret doesn't contain the right value but something else.
Reason I am asking that is that I want to make sure that if the variable is not null or empty, it will always contain the secret and not other random string.
.Resultis almost always wrong -string kvSecret = await kVClient.GetSecretAsync(azureKeyVaultUrl, secret);sounds more likelykvSecretwill be inaccessible; if no exception is thrown, the value is whatever the API returns