Skip to content

Update Clone isolation test for Abstractions 12.6.1 - #4021

Merged
Bogdan Gavril (bgavrilMS) merged 1 commit into
gladjohn-MicrosoftIdentityAbstractionsVersionfrom
iarekk/fix-clone-isolation-test
Sep 1, 2026
Merged

Bogdan Gavril (bgavrilMS) merged 1 commit into
gladjohn-MicrosoftIdentityAbstractionsVersionfrom
iarekk/fix-clone-isolation-test

Conversation

@iarekk

Copy link
Copy Markdown
Contributor

Summary

Targets #4020. That PR bumps MicrosoftIdentityAbstractionsVersion to 12.6.1,
which changes Clone() / the copy constructors on AcquireTokenOptions and
DownstreamApiOptions to allocate independent containers for their mutable
collections (ExtraParameters, ExtraQueryParameters, ExtraHeadersParameters)
instead of copying the references
(AzureAD/microsoft-identity-abstractions-for-dotnet#269).

SidecarOptionsIsolationTests.Clone_IsShallow_OnSharedMutableCollections was
written to document the previous shared-reference behavior (it asserts
Assert.Same on the collections and that a write to the clone appears on the
original). Under 12.6.1 those assertions invert, so the test fails the
Build & Unit Tests run on #4020.

Change

Rename the test to Clone_IsolatesSharedMutableCollections and assert the new
behavior: after Clone(), the mutable collections are NotSame and a write to
the clone does not appear on the original. The sibling
CloneForRequest_ReallocatesSharedMutableCollections test is unaffected (it
still re-allocates and still passes).

Notes

  • Test-only change; no product code touched.
  • DownstreamApiOptionsMerger.CloneForRequest is now effectively belt-and-
    suspenders (the underlying Clone() already isolates), but it remains correct
    and is left as-is; simplifying it can be a separate follow-up.

Testing

SidecarOptionsIsolationTests passes against 12.6.1 (net10.0). Core
Microsoft.Identity.Web.Test unit tests pass against 12.6.1 as well.

Microsoft.Identity.Abstractions 12.6.1 changes Clone()/copy constructors to
allocate independent containers for the mutable collections (ExtraParameters,
ExtraQueryParameters, ExtraHeadersParameters). SidecarOptionsIsolationTests
.Clone_IsShallow_OnSharedMutableCollections asserted the previous shared-
reference behavior and now fails.

Rename it to Clone_IsolatesSharedMutableCollections and assert the collections
are independent after Clone() (NotSame, and a write to the clone does not appear
on the original). The sibling CloneForRequest test is unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d7561d5-2377-4311-b964-18a751a83302
@bgavrilMS
Bogdan Gavril (bgavrilMS) merged commit 3fb0425 into gladjohn-MicrosoftIdentityAbstractionsVersion Sep 1, 2026
2 checks passed
@bgavrilMS
Bogdan Gavril (bgavrilMS) deleted the iarekk/fix-clone-isolation-test branch September 1, 2026 10:35
Bogdan Gavril (bgavrilMS) pushed a commit that referenced this pull request Sep 1, 2026
Microsoft.Identity.Abstractions 12.6.1 changes Clone()/copy constructors to
allocate independent containers for the mutable collections (ExtraParameters,
ExtraQueryParameters, ExtraHeadersParameters). SidecarOptionsIsolationTests
.Clone_IsShallow_OnSharedMutableCollections asserted the previous shared-
reference behavior and now fails.

Rename it to Clone_IsolatesSharedMutableCollections and assert the collections
are independent after Clone() (NotSame, and a write to the clone does not appear
on the original). The sibling CloneForRequest test is unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d7561d5-2377-4311-b964-18a751a83302
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.

2 participants