Skip to content

Use shared clipboard code - #10544

Merged
harshit7962 merged 13 commits into
dotnet:mainfrom
JeremyKuhne:sharedclipboard
Apr 2, 2025
Merged

harshit7962 merged 13 commits into
dotnet:mainfrom
JeremyKuhne:sharedclipboard

Conversation

@JeremyKuhne

@JeremyKuhne JeremyKuhne commented Mar 7, 2025 •

Copy link
Copy Markdown
Member

This PR switches to using the shared clipboard code coming from System.Private.Windows.Core and exposes the new typed and JSON APIs.

Removes all code no longer used.

The PR includes the existing refactoring PR. The final commit is the actual clipboard change.

Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings March 7, 2025 01:00
@JeremyKuhne
JeremyKuhne requested review from a team as code owners March 7, 2025 01:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This pull request switches the clipboard implementation to use shared clipboard code from System.Private.Windows.Core, exposing new typed and JSON APIs while removing unused code.

  • Updated global suppressions for new clipboard-related members
  • Refactored System.Drawing helper methods with nullable annotations and updated signature types
  • Added new global using directives for clipboard-related types

Reviewed Changes

File Description
src/Microsoft.DotNet.Wpf/src/PresentationCore/GlobalSuppressions.cs Added suppressions for new clipboard API members
src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemDrawing/SystemDrawingExtension.cs Refactored helper methods with nullable support and updated API usage
src/Microsoft.DotNet.Wpf/src/PresentationCore/GlobalUsings.cs Introduced new global usings for shared clipboard and related functionality
src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/SystemDrawingHelper.cs Updated helper methods to align with new System.Drawing API signatures

Copilot reviewed 107 out of 107 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/SystemDrawingHelper.cs:28

  • Consider using a named null handle constant (e.g., HENHMETAFILE.Null) instead of the literal 0 for clarity and consistency with other methods that return HBITMAP.Null.
internal static HENHMETAFILE GetHandleFromMetafile(object? data) => (HENHMETAFILE)(AssemblyHelper.ExtensionsForSystemDrawing()?.GetHandleFromMetafile(data) ?? 0);

@dotnet-policy-service dotnet-policy-service Bot added the PR metadata: Label to tag PRs, to facilitate with triage label Mar 7, 2025
@codecov

codecov Bot commented Mar 7, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 47.10579% with 265 lines in your changes missing coverage. Please review.

Project coverage is 10.96190%. Comparing base (f18b874) to head (b33ea57).
Report is 16 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10544         +/-   ##
===================================================
- Coverage   11.21623%   10.96190%   -0.25433%     
===================================================
  Files           3353        3310         -43     
  Lines         668041      664693       -3348     
  Branches       74980       74667        -313     
===================================================
- Hits           74929       72863       -2066     
+ Misses        591866      590690       -1176     
+ Partials        1246        1140        -106     
Flag Coverage Δ
Debug 10.96190% <47.10579%> (-0.25433%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@harshit7962 harshit7962 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still going through the PR, posting the review to get current queries/nits addressed.

harshit7962
harshit7962 previously approved these changes Mar 20, 2025

@harshit7962 harshit7962 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JeremyKuhne

Copy link
Copy Markdown
Member Author

@h3xds1nz I'll respond to your feedback when I rebase tomorrow

Bring code closer to current standards.
Switch to using a typed dictionary. Extra fields in DataStoreEntry were never used. Removed to align with shared implementation.
This commit switches to using the shared clipboard code coming from System.Private.Windows.Core and exposes the new typed and JSON APIs.

Removes all code no longer used.
Remove duplicate project file entry

@harshit7962 harshit7962 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test pass on these changes are done, no failures were reported.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants