Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Clipboard and DataObject code to Core #12868

Merged
merged 3 commits into from
Feb 1, 2025

Conversation

JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Jan 31, 2025

Moves some logic to helpers in Core.

Microsoft Reviewers: Open in CodeFlow

Moves some logic to helpers in Core.
Copy link

codecov bot commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 74.31694% with 47 lines in your changes missing coverage. Please review.

Project coverage is 76.13584%. Comparing base (f790266) to head (8a320aa).
Report is 2 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #12868         +/-   ##
===================================================
+ Coverage   76.13091%   76.13584%   +0.00493%     
===================================================
  Files           3249        3251          +2     
  Lines         642492      642520         +28     
  Branches       47284       47286          +2     
===================================================
+ Hits          489135      489188         +53     
+ Misses        149814      149791         -23     
+ Partials        3543        3541          -2     
Flag Coverage Δ
Debug 76.13584% <74.31694%> (+0.00493%) ⬆️
integration 18.10003% <29.44444%> (+0.00981%) ⬆️
production 50.08579% <73.88889%> (+0.01365%) ⬆️
test 96.97819% <100.00000%> (ø)
unit 47.51700% <73.88889%> (+0.01425%) ⬆️

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

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 15 changed files in this pull request and generated no comments.

Files not reviewed (10)
  • src/System.Private.Windows.Core/src/System/Private/Windows/Runtime.cs: Evaluated as low risk
  • src/System.Windows.Forms/src/GlobalUsings.cs: Evaluated as low risk
  • src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataFormats.cs: Evaluated as low risk
  • src/System.Private.Windows.Core/src/System/Private/Windows/Ole/DataStore.DataStoreEntry.cs: Evaluated as low risk
  • src/System.Private.Windows.Core/src/System/Private/Windows/Ole/DataStore.cs: Evaluated as low risk
  • src/System.Private.Windows.Core/src/System/Private/Windows/Ole/IOleServices.cs: Evaluated as low risk
  • src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs: Evaluated as low risk
  • src/System.Windows.Forms/src/GlobalSuppressions.cs: Evaluated as low risk
  • src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs: Evaluated as low risk
  • src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ClipboardTests.cs: Evaluated as low risk
Comments suppressed due to low confidence (7)

src/System.Private.Windows.Core/src/System/Private/Windows/Ole/DataObjectCore.cs:21

  • Ensure that the behavior of TryJsonSerialize, especially the InvalidOperationException for TDataObject, is covered by tests.
internal static object TryJsonSerialize<T>(string format, T data)

src/System.Private.Windows.Core/src/System/Private/Windows/Ole/DataObjectCore.cs:46

  • Ensure that the CreateComposition method handles all possible cases correctly, particularly the application of the adapterFactory function.
internal static Composition<TRuntime, TDataFormat> CreateComposition(object data, Func<TIDataObject, IDataObjectInternal> adapterFactory)

src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs:30

  • Ensure that the EnsureThreadState method is correctly implemented in classes implementing IOleServices.
TOleServices.EnsureThreadState();

src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs:180

  • Ensure that the IsValidTypeForFormat method in TOleServices is correctly implemented and that the call from ClipboardCore is valid.
TOleServices.IsValidTypeForFormat(type, format)

src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs:71

  • Confirm that the PInvoke calls (OleSetClipboard and OleFlushClipboard) are correct and that the retry logic is robust and handles errors appropriately.
while ((result = PInvokeCore.OleSetClipboard(iDataObject)).Failed)

src/System.Private.Windows.Core/src/System/Private/Windows/Ole/ClipboardCore.cs:114

  • Confirm that the PInvoke call (OleGetClipboard) is correct and that the proxy handling and retry logic are correct.
while ((result = PInvokeCore.OleGetClipboard(proxyDataObject)).Failed)

src/System.Windows.Forms/src/System/Windows/Forms/OLE/WinFormsOleServices.cs:103

  • The visibility of the method TryGetBitmapData has been changed from private to static. This change should be reviewed to ensure it was intentional.
static unsafe bool TryGetBitmapData(Com.IDataObject* dataObject, [NotNullWhen(true)] out Bitmap? data)
@JeremyKuhne JeremyKuhne merged commit 85dcb7b into dotnet:main Feb 1, 2025
8 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview2 milestone Feb 1, 2025
@JeremyKuhne JeremyKuhne deleted the factorclip9 branch February 1, 2025 18:52
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.

2 participants