Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Task to ValueTask. #2287

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ public string Validate(
SecurityToken securityToken,
TokenValidationParameters validationParameters)
{
return ValidateAsync(issuer, securityToken, validationParameters).GetAwaiter().GetResult();
ValueTask<string> vt = ValidateAsync(issuer, securityToken, validationParameters);
return vt.IsCompletedSuccessfully ?
vt.Result :
vt.AsTask().GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -145,7 +148,7 @@ public string Validate(
/// <exception cref="ArgumentNullException"> if <paramref name="securityToken"/> is null.</exception>
/// <exception cref="ArgumentNullException"> if <paramref name="validationParameters"/> is null.</exception>
/// <exception cref="SecurityTokenInvalidIssuerException">if the issuer is invalid or if there is a network issue. </exception>
internal async Task<string> ValidateAsync(
internal async ValueTask<string> ValidateAsync(
string issuer,
SecurityToken securityToken,
TokenValidationParameters validationParameters)
Expand Down