Skip to content

[cherry pick] Use TokenValidationParameter copy constructor to make a deep copy #3488

Merged
westin-m merged 3 commits into
dev8xfrom
westin/cherry-pick-tvp-clone
May 27, 2026
Merged

[cherry pick] Use TokenValidationParameter copy constructor to make a deep copy #3488
westin-m merged 3 commits into
dev8xfrom
westin/cherry-pick-tvp-clone

Conversation

@westin-m
Copy link
Copy Markdown
Contributor

cherry picks the fix for Bug 3423710: TokenValidationParameters.Clone does not make a deep copy

)

* make a deep copy with copy constructor

* PR feedback
@westin-m westin-m requested a review from a team as a code owner May 13, 2026 21:50
@westin-m westin-m changed the title Use TokenValidationParameter copy constructor to make a deep copy [cherry pick] Use TokenValidationParameter copy constructor to make a deep copy May 13, 2026
Copy link
Copy Markdown
Contributor

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

Cherry-picks a fix for Bug 3423710 by updating TokenValidationParameters.Clone()/copy-constructor behavior so cloned instances don’t share mutable collection state with the original, and updates tests/docs accordingly.

Changes:

  • Deep-copies collection properties in the TokenValidationParameters(TokenValidationParameters other) copy constructor (lists/dictionaries).
  • Updates Clone() implementation and XML documentation to reflect the intended clone semantics.
  • Extends TokenValidationParametersTests.Clone() with additional assertions around clone independence.

Reviewed changes

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

File Description
src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs Updates the copy constructor and clone docs/implementation to avoid sharing mutable collections between original and clone.
test/Microsoft.IdentityModel.Tokens.Tests/TokenValidationParametersTests.cs Updates clone test expectations; should validate collection deep-copy behavior.

Comment thread src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs Outdated
Comment thread src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs Outdated
Comment thread test/Microsoft.IdentityModel.Tokens.Tests/TokenValidationParametersTests.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@westin-m westin-m merged commit 3c0c4dd into dev8x May 27, 2026
2 checks passed
@westin-m westin-m deleted the westin/cherry-pick-tvp-clone branch May 27, 2026 16:48
This was referenced Jun 2, 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.

4 participants