Repository navigation
Refuse a DeepCloneFrom between OrderedDictionaries or ConcurrentDictionaries with different comparers [patch] - #145
Merged
matt-edmondson merged 1 commit intoNov 13, 2026
Conversation
…entDictionaries with different comparers EnsureSameComparer only checked Dictionary, SortedDictionary and SortedList, so a case-insensitive OrderedDictionary or ConcurrentDictionary source was copied into an ordinal destination without error, and lookups that worked on the source missed on the clone. Both kinds are now checked; the concurrent comparer is read through ConcurrentComparer.Of so the netstandard builds work. Fixes #143 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW3WKKpY45VJvchCp92
|
This was referenced Nov 12, 2026
matt-edmondson
deleted the
fix/143-deepclonefrom-ordered-concurrent-comparer
branch
November 13, 2026 21:43
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #143
What changed
EnsureSameComparer<TKey, TValue>only checkedDictionary,SortedDictionaryandSortedList. A case-insensitiveOrderedDictionaryorConcurrentDictionarysource could be copied into an ordinal destination with no error, and lookups that worked on the source then missed on the clone. It now checks:OrderedDictionary<TKey, TValue>, guarded by#if NET9_0_OR_GREATERConcurrentDictionary<TKey, TValue>. Its comparer is read through the existingConcurrentComparer<TKey, TValue>.Of, so this also works on the netstandard targets.DeepCloneFromXML doc, the README and CLAUDE.md.IDictionarywhose comparer can be read. This PR is scoped to the two kinds the issue names.Tests
DeepCloneFromComparerTests:ArgumentExceptionand leavesdestunchangedGenerated by Claude Code