add .ConfigureAwait(false) (#11)
This commit is contained in:
Родитель
a8e02239ef
Коммит
9e361d7ebf
|
@ -27,5 +27,5 @@ queueClient.RegisterPlugin(keyVaultPlugin);
|
|||
|
||||
var message = new Message(Encoding.UTF8.GetBytes("Super secret message"));
|
||||
|
||||
await queueClient.SendAsync(message);
|
||||
await queueClient.SendAsync(message).ConfigureAwait(false);
|
||||
```
|
|
@ -21,7 +21,7 @@ queueClient.RegisterPlugin(messageIdPlugin);
|
|||
|
||||
var message = new Message(Encoding.UTF8.GetBytes("Message with GUID message ID"));
|
||||
|
||||
await queueClient.SendAsync(message);
|
||||
await queueClient.SendAsync(message).ConfigureAwait(false);
|
||||
|
||||
// message.MessageId will be assigned a GUID in a 32 digit format w/o hyphens or braces
|
||||
```
|
||||
|
|
|
@ -84,13 +84,13 @@ namespace Microsoft.Azure.ServiceBus.KeyVault
|
|||
return message;
|
||||
}
|
||||
|
||||
var secret = await secretManager.GetHashedSecret(secretName, secretVersion);
|
||||
var secret = await secretManager.GetHashedSecret(secretName, secretVersion).ConfigureAwait(false);
|
||||
|
||||
message.UserProperties.Add(KeyVaultMessageHeaders.InitializationVectorPropertyName, base64InitializationVector);
|
||||
message.UserProperties.Add(KeyVaultMessageHeaders.KeyNamePropertyName, secretName);
|
||||
message.UserProperties.Add(KeyVaultMessageHeaders.KeyVersionPropertyName, secretVersion);
|
||||
|
||||
message.Body = await KeyVaultPlugin.Encrypt(message.Body, secret, this.initializationVector);
|
||||
message.Body = await KeyVaultPlugin.Encrypt(message.Body, secret, this.initializationVector).ConfigureAwait(false);
|
||||
return message;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -130,9 +130,9 @@ namespace Microsoft.Azure.ServiceBus.KeyVault
|
|||
message.UserProperties.Remove(KeyVaultMessageHeaders.KeyVersionPropertyName);
|
||||
}
|
||||
|
||||
var secret = await secretManager.GetHashedSecret(secretName, secretVersion);
|
||||
var secret = await secretManager.GetHashedSecret(secretName, secretVersion).ConfigureAwait(false);
|
||||
|
||||
var decryptedMessage = await KeyVaultPlugin.Decrypt(message.Body, secret, iV);
|
||||
var decryptedMessage = await KeyVaultPlugin.Decrypt(message.Body, secret, iV).ConfigureAwait(false);
|
||||
|
||||
message.Body = decryptedMessage;
|
||||
return message;
|
||||
|
@ -166,7 +166,7 @@ namespace Microsoft.Azure.ServiceBus.KeyVault
|
|||
|
||||
var encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
||||
|
||||
return await PerformCryptography(encryptor, payload);
|
||||
return await PerformCryptography(encryptor, payload).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ namespace Microsoft.Azure.ServiceBus.KeyVault
|
|||
|
||||
var decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
|
||||
|
||||
return await PerformCryptography(decryptor, payload);
|
||||
return await PerformCryptography(decryptor, payload).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ namespace Microsoft.Azure.ServiceBus.KeyVault
|
|||
using (var cryptoStream = new CryptoStream(memoryStream, cryptoTransform, CryptoStreamMode.Write))
|
||||
{
|
||||
// Write all data to the memory stream.
|
||||
await cryptoStream.WriteAsync(data, 0, data.Length);
|
||||
await cryptoStream.WriteAsync(data, 0, data.Length).ConfigureAwait(false);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
return memoryStream.ToArray();
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Microsoft.Azure.ServiceBus.KeyVault
|
|||
return secretCache[combinedNameAndVersion];
|
||||
}
|
||||
|
||||
var secret = await GetSecretFromKeyVault(secretName, secretVersion);
|
||||
var secret = await GetSecretFromKeyVault(secretName, secretVersion).ConfigureAwait(false);
|
||||
using (var sha256 = SHA256.Create())
|
||||
{
|
||||
var secretAsBytes = Encoding.UTF8.GetBytes(secret);
|
||||
|
@ -79,11 +79,11 @@ namespace Microsoft.Azure.ServiceBus.KeyVault
|
|||
SecretBundle secretResult;
|
||||
if (string.IsNullOrWhiteSpace(secretVersion))
|
||||
{
|
||||
secretResult = await keyVaultClient.GetSecretAsync(this.KeyVaultUrl, secretName);
|
||||
secretResult = await keyVaultClient.GetSecretAsync(this.KeyVaultUrl, secretName).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
secretResult = await keyVaultClient.GetSecretAsync(this.KeyVaultUrl, secretName, secretVersion);
|
||||
secretResult = await keyVaultClient.GetSecretAsync(this.KeyVaultUrl, secretName, secretVersion).ConfigureAwait(false);
|
||||
}
|
||||
return secretResult.Value;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace Microsoft.Azure.ServiceBus.KeyVault
|
|||
|
||||
try
|
||||
{
|
||||
var result = await ctx.AcquireTokenAsync(resource, credential);
|
||||
var result = await ctx.AcquireTokenAsync(resource, credential).ConfigureAwait(false);
|
||||
return result.AccessToken;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
Загрузка…
Ссылка в новой задаче