Skip to content

Promote MsalServiceException.SubError to public#6063

Merged
neha-bhargava merged 5 commits into
mainfrom
nebharg/metadata-surface-poc
Jun 16, 2026
Merged

Promote MsalServiceException.SubError to public#6063
neha-bhargava merged 5 commits into
mainfrom
nebharg/metadata-surface-poc

Conversation

@neha-bhargava

@neha-bhargava neha-bhargava commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Promotes MsalServiceException.SubError getter from internal to public so downstream layers can map richer error diagnostics through the outbound token-acquisition pipeline. Setter stays internal — only MSAL produces these values.

What's proposed

  • MsalServiceException.SubError — getter promoted from internal to public (net-new public surface on MsalServiceException; MsalException has no SubError member). Setter remains internal — only MSAL writes this value from the wire.

  • PublicAPI baseline files updated per the project's analyzer.

Why

SubError discriminates failure subtypes within a single ErrorCode. E.g. invalid_grant can be qualified by consent_required (caller should re-prompt), bad_token (drop the cached entry), or protection_policy_required (satisfy a CA challenge). Without public access, consumers building structured error surfaces (e.g. TokenAcquisitionFailureDetails in Microsoft.Identity.Abstractions) fall back to string-parsing Message.

Compatibility

Widening a getter from internal to public is non-breaking on all three axes (binary, source, type-check). The setter is unchanged.

References

Promotes the server-emitted OAuth sub-error from internal to public so callers can distinguish fine-grained ESTS failure cases (consent_required, bad_token, protection_policy_required, etc.) that are otherwise indistinguishable inside a single ErrorCode such as invalid_grant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 promotes MsalServiceException.SubError to a public API so downstream libraries can access and propagate richer service error diagnostics without message parsing.

Changes:

  • Makes MsalServiceException.SubError publicly gettable/settable and adds XML documentation describing its diagnostic nature.
  • Updates PublicAPI baselines (Unshipped) across all supported target frameworks to reflect the new public surface.

Reviewed changes

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

Show a summary per file
File Description
src/client/Microsoft.Identity.Client/MsalServiceException.cs Changes SubError from internal to public and documents intended usage/semantics.
src/client/Microsoft.Identity.Client/PublicApi/netstandard2.0/PublicAPI.Unshipped.txt Adds the new public getter/setter to the netstandard2.0 API baseline.
src/client/Microsoft.Identity.Client/PublicApi/net462/PublicAPI.Unshipped.txt Adds the new public getter/setter to the net462 API baseline.
src/client/Microsoft.Identity.Client/PublicApi/net472/PublicAPI.Unshipped.txt Adds the new public getter/setter to the net472 API baseline.
src/client/Microsoft.Identity.Client/PublicApi/net8.0/PublicAPI.Unshipped.txt Adds the new public getter/setter to the net8.0 API baseline.
src/client/Microsoft.Identity.Client/PublicApi/net8.0-android/PublicAPI.Unshipped.txt Adds the new public getter/setter to the net8.0-android API baseline.
src/client/Microsoft.Identity.Client/PublicApi/net8.0-ios/PublicAPI.Unshipped.txt Adds the new public getter/setter to the net8.0-ios API baseline.

…l (only getter is net-new public surface)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@neha-bhargava

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

@neha-bhargava neha-bhargava marked this pull request as ready for review June 15, 2026 18:04
@neha-bhargava neha-bhargava requested a review from a team as a code owner June 15, 2026 18:04
Copilot AI review requested due to automatic review settings June 15, 2026 18:04
@neha-bhargava neha-bhargava changed the title [POC] Promote MsalServiceException.SubError to public Promote MsalServiceException.SubError to public Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/client/Microsoft.Identity.Client/MsalServiceException.cs Outdated

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts locally in f1c5b7658 by merging origin/main and keeping both the existing Azure cloud PublicAPI entries and the MsalServiceException.SubError baseline entry. I couldn't update the PR branch because GitHub rejected the push to nebharg/metadata-surface-poc as a protected ref (GH013).

Comment thread src/client/Microsoft.Identity.Client/MsalServiceException.cs Outdated
Addresses reviewer comment: clarifies the property is intended for diagnostics/logging, not production branching. Public getter renamed; internal setter renamed in lockstep across the call graph (Throttled* copy ctors, MsalUiRequiredException.Classification accessor, CacheSilentStrategy FOCI fallback, MsalServiceException JSON round-trip). OAuth2ResponseBase.SubError (wire-level field) intentionally untouched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 15, 2026 20:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Comment thread src/client/Microsoft.Identity.Client/MsalServiceException.cs
@neha-bhargava neha-bhargava merged commit 174ed4f into main Jun 16, 2026
15 checks passed
@neha-bhargava neha-bhargava deleted the nebharg/metadata-surface-poc branch June 16, 2026 18:36
@neha-bhargava neha-bhargava added this to the 4.85.0 milestone Jun 19, 2026
This was referenced Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants