Skip to content

Fix XML comments for return values on IAuthorizationService #62765

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 17, 2025

The XML documentation for IAuthorizationService methods and their extension methods incorrectly described return values as boolean flags, when they actually return Task<AuthorizationResult>.

Before:

/// <returns>
/// A flag indicating whether authorization has succeeded.
/// This value is <c>true</c> when the user fulfills the policy; otherwise <c>false</c>.
/// </returns>

After:

/// <returns>
/// A <see cref="Task{TResult}"/> that contains an <see cref="AuthorizationResult"/> indicating whether authorization has succeeded.
/// The result's <see cref="AuthorizationResult.Succeeded"/> property is <c>true</c> when the user fulfills the policy; otherwise <c>false</c>.
/// </returns>

Changes:

  • Updated XML documentation for 2 methods in IAuthorizationService.cs
  • Updated XML documentation for 4 extension methods in AuthorizationServiceExtensions.cs
  • Documentation now correctly references Task<AuthorizationResult> return type
  • Added proper XML references to Task{TResult} and AuthorizationResult types
  • Clarified that boolean success indication is available via AuthorizationResult.Succeeded property

The documentation now accurately reflects the actual return types and provides clear guidance on how to check authorization results.

Fixes #62764.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor

Greetings human! You've submitted a PR that modifies code that is shared with https://github.com/dotnet/runtime . Please make sure you synchronize this code with the changes in that repo!

@Copilot Copilot AI changed the title [WIP] Fix XML comments for return values on IAuthorizationService Fix XML comments for return values on IAuthorizationService Jul 17, 2025
Copilot finished work on behalf of JamesNK July 17, 2025 05:25
@Copilot Copilot AI requested a review from JamesNK July 17, 2025 05:25
@JamesNK
Copy link
Member

JamesNK commented Jul 17, 2025

@copilot Also update DefaultAuthorizationService

Updated XML documentation for DefaultAuthorizationService methods to correctly describe return values as Task<AuthorizationResult> instead of boolean flags, matching the pattern used for IAuthorizationService interface.

Co-authored-by: JamesNK <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jul 17, 2025

@copilot Also update DefaultAuthorizationService

Updated DefaultAuthorizationService XML comments to match the corrected pattern (e5260c8). Both AuthorizeAsync methods now correctly describe their return values as Task instead of boolean flags.

Copilot finished work on behalf of JamesNK July 17, 2025 05:38
@JamesNK JamesNK marked this pull request as ready for review July 17, 2025 05:38
@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 05:38
@JamesNK JamesNK requested a review from halter73 as a code owner July 17, 2025 05:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the XML <returns> documentation on IAuthorizationService methods and their extensions to accurately describe the Task<AuthorizationResult> return type and guide consumers to use the AuthorizationResult.Succeeded property for success checks.

  • Corrected <returns> tags in the interface, default implementation, and extension methods
  • Added <see> references for Task{TResult} and AuthorizationResult
  • Clarified usage of AuthorizationResult.Succeeded instead of boolean return flags

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Security/Authorization/Core/src/IAuthorizationService.cs Updated <returns> doc on interface methods
src/Security/Authorization/Core/src/DefaultAuthorizationService.cs Updated <returns> doc on implementation
src/Security/Authorization/Core/src/AuthorizationServiceExtensions.cs Updated <returns> doc on extension methods
Comments suppressed due to low confidence (2)

src/Security/Authorization/Core/src/IAuthorizationService.cs:25

  • For clearer XML linkage, reference the concrete return type by using <see cref="Task{AuthorizationResult}"/> instead of the generic <see cref="Task{TResult}"/>.
    /// A <see cref="Task{TResult}"/> that contains an <see cref="AuthorizationResult"/> indicating whether authorization has succeeded.

src/Security/Authorization/Core/src/AuthorizationServiceExtensions.cs:24

  • [nitpick] To reduce duplicated XML comments across multiple overloads, consider using <inheritdoc cref="IAuthorizationService.AuthorizeAsync(ClaimsPrincipal, object?, IAuthorizationRequirement)"/> (and equivalents) in each extension method.
    /// A <see cref="Task{TResult}"/> that contains an <see cref="AuthorizationResult"/> indicating whether requirement evaluation has succeeded or failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix XML comments for return values on IAuthorizationService
2 participants