Skip to content

[release/11.0] Prevent clipboard hangs during concurrent data-store access - #15329

Merged
Shyam-Gupta merged 1 commit into
release/11.0from
backport/pr-15319-to-release/11.0
Oct 29, 2026
Merged

Shyam-Gupta merged 1 commit into
release/11.0from
backport/pr-15319-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes 3084829

Backport of #15319 to release/11.0

/cc @Shyam-Gupta @nareshjo

Root Cause

The clipboard data store reads, writes, and enumerates its format dictionary without synchronization. Concurrent mutation can corrupt dictionary state; on .NET Framework, a corrupted bucket chain can cause a later lookup to loop indefinitely.

Proposed changes

  • Protect the clipboard data store's format dictionary against overlapping managed calls and COM callbacks.
  • Capture complete entries and coherent format snapshots while keeping validation, deserialization, and format mapping outside the per-store gate.
  • Cover concurrent insertion and overwrites, callback reentrancy, format compatibility, and native storage-medium ownership with regression tests.

Customer Impact

  • The synchronization gap was identified while investigating customer-reported clipboard hangs. This change addresses a dictionary-corruption race that can cause clipboard operations to fail or hang.
  • Existing format mapping and native drag-and-drop ownership behavior are preserved; no public API changes.

Regression?

  • Unconfirmed. The unsynchronized dictionary predates this change; an introducing release has not been established.

Risk

Low expected compatibility risk. The per-store gate protects dictionary access and snapshot creation; validation, deserialization, format mapping, and explicit COM calls stay outside locked sections. Payload ownership is unchanged. Lock contention and larger snapshots add potential performance costs.

Test methodology

  • Exercise colliding concurrent insertions, concurrent reads and overwrites, complete data/flag publication, and coherent format enumeration.
  • Verify validation and deserialization callbacks can wait for another thread to access the store. Check format mapping/order, validation failures, serializable first-entry behavior, and native-medium ownership.
  • Rebuild the affected test project with the repository's Arcade workflow in Debug and Release. Run the final DataStore regression tests on both targets: 10 Framework cases and 11 modern .NET cases per configuration, totaling 42 passes with no failures or skips.
  • Exercise the exact timeout-cleanup block in an isolated Framework harness with completed, cancellable, and delayed workers. All three checks passed; this checks cleanup behavior, not product COM contention.
  • Basic copy/paste and undo smoke checks with a consumer using the same production fix completed without observed failures. The original intermittent hang has not been reproduced and verified fixed.

Test environment(s)

  • Windows x64, Debug and Release.
  • .NET Framework 4.8.1 target (net481).
  • Modern target: net11.0-windows7.0, executed using the repository-selected .NET runtime 12.0.0-alpha.1.26519.114.
  • Repository-local .NET SDK: 12.0.100-alpha.1.26480.102.
Microsoft Reviewers: Open in CodeFlow

@github-actions
github-actions Bot requested a review from a team as a code owner October 28, 2026 18:30
@Shyam-Gupta Shyam-Gupta self-assigned this Oct 28, 2026
@Shyam-Gupta Shyam-Gupta added servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria area-Clipboard Issues related to Clipboard labels Oct 28, 2026
@Shyam-Gupta Shyam-Gupta added servicing-approved .NET Shiproom approved the PR for merge and removed servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria labels Oct 29, 2026
@Shyam-Gupta

Copy link
Copy Markdown
Member

Approved over email.

@Shyam-Gupta
Shyam-Gupta merged commit 386d232 into release/11.0 Oct 29, 2026
8 checks passed
@Shyam-Gupta
Shyam-Gupta deleted the backport/pr-15319-to-release/11.0 branch October 29, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Clipboard Issues related to Clipboard servicing-approved .NET Shiproom approved the PR for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants