Skip to content

[Frozen] Document duplicate handling in summaries of all FrozenDictionary factory methods - #134318

Open
priyadarshnisundararajan wants to merge 2 commits into
dotnet:mainfrom
priyadarshnisundararajan:docs/frozen-dictionary-duplicate-handling
Open

priyadarshnisundararajan wants to merge 2 commits into
dotnet:mainfrom
priyadarshnisundararajan:docs/frozen-dictionary-duplicate-handling

Conversation

@priyadarshnisundararajan

Copy link
Copy Markdown

Fixes #127798 (documentation half only — no behavior change; behavioral alignment stays deferred to #113096).

Problem

The three key/value pair-based factories (Create x2, ToFrozenDictionary(IEnumerable<KeyValuePair<TKey, TValue>>)) document their last-duplicate-wins behavior only in <remarks>, which does not show up in IntelliSense tooltips, while the two key/element selector overloads document nothing at all even though they throw ArgumentException on duplicates (inherited from Enumerable.ToDictionary). Callers switching source types get caught off-guard by the difference.

Change (docs only)

  • The three KVP-based factories now state in <summary>: "If the same key appears multiple times in the input, the latter one in the sequence takes precedence." (The existing <remarks> text is left unchanged.)
  • The two selector overloads now state in <summary> that they throw ArgumentException if keySelector produces duplicate keys, contrasting with the KVP-based overloads.

Testing

  • Docs-only change; no runtime tests added or needed.
  • Verified every XML doc comment in the edited file is well-formed, and that no non-doc line in the file changed.

Note: @caraioniurie47 posted a full analysis in the thread on 2026-09-11 offering to send this PR; opening it now as none materialized — happy to hand it over if you'd rather take it.

…nary factory methods

The three KVP-based factories documented last-duplicate-wins only in remarks (invisible to IntelliSense tooltips); the two key/element selector overloads documented nothing despite throwing ArgumentException on duplicates. State both in summary.

Signed-off-by: Priyadarshni Sundararajan <priyadarshnisundararajan@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 21, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-collections
See info in area-owners.md if you want to be subscribed.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@priyadarshnisundararajan
priyadarshnisundararajan marked this pull request as ready for review September 21, 2026 04:50
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@caraioniurie47

Copy link
Copy Markdown
Contributor

@priyadarshnisundararajan Thanks for picking this up and for the credit; please go ahead with it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Collections community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToFrozenDictionary overloads differ in duplicate handling

2 participants