diff --git a/src/Microsoft.IdentityModel.Tokens/Validation/AudienceValidationResult.cs b/src/Microsoft.IdentityModel.Tokens/Validation/AudienceValidationResult.cs index bb1573c1ab..024cca68ba 100644 --- a/src/Microsoft.IdentityModel.Tokens/Validation/AudienceValidationResult.cs +++ b/src/Microsoft.IdentityModel.Tokens/Validation/AudienceValidationResult.cs @@ -48,8 +48,7 @@ public override Exception Exception HasValidOrExceptionWasRead = true; _exception = ExceptionDetail.GetException(); - SecurityTokenInvalidAudienceException securityTokenInvalidAudienceException = _exception as SecurityTokenInvalidAudienceException; - if (securityTokenInvalidAudienceException != null) + if (_exception is SecurityTokenInvalidAudienceException securityTokenInvalidAudienceException) { securityTokenInvalidAudienceException.InvalidAudience = Audience; securityTokenInvalidAudienceException.ExceptionDetail = ExceptionDetail;