Skip to content

Commit

Permalink
fix(iot-svc): update debug assert
Browse files Browse the repository at this point in the history
  • Loading branch information
David R. Williamson committed Jan 3, 2022
1 parent d22f9f3 commit e497aa8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions iothub/device/src/IotHubConnectionString.Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ Task<string> IAuthorizationProvider.GetPasswordAsync()
if (Logging.IsEnabled)
Logging.Enter(this, $"{nameof(IotHubConnectionString)}.{nameof(IAuthorizationProvider.GetPasswordAsync)}");

Debug.Assert(TokenRefresher != null);
Debug.Assert(
!string.IsNullOrWhiteSpace(SharedAccessSignature)
|| TokenRefresher != null,
"The token refresher and the shared access signature can't both be null");

return !string.IsNullOrWhiteSpace(SharedAccessSignature)
? Task.FromResult(SharedAccessSignature)
: TokenRefresher.GetTokenAsync(Audience);
: TokenRefresher?.GetTokenAsync(Audience);
}
finally
{
Expand Down

0 comments on commit e497aa8

Please sign in to comment.