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

Adding new strongly typed methods to Clipboard, DataObject and IDataObject. #11545

Merged
merged 9 commits into from
Dec 12, 2024

Conversation

Tanya-Solyanik
Copy link
Member

@Tanya-Solyanik Tanya-Solyanik commented Jun 18, 2024

Related to ##12362
Fixes #11350

The TryGetData methods use NRBF deserializer by default and will fall back to use BinaryFormatter if the application opts into BinaryFormatter use in this context.
The GetData methods have a compatibility mode when the appropriate AppContext switches are enabled but by default they can read only known and primitive types or POCOs with primitive fields. These methods in the DataObject class are obsoleted.

Microsoft Reviewers: Open in CodeFlow

Copy link
Member

@JeremyKuhne JeremyKuhne left a comment

Choose a reason for hiding this comment

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

Added some comments.

@dotnet-policy-service dotnet-policy-service bot added 📭 waiting-author-feedback The team requires more information from the author and removed 📭 waiting-author-feedback The team requires more information from the author labels Jun 20, 2024
@Tanya-Solyanik Tanya-Solyanik force-pushed the cb-9 branch 6 times, most recently from 816f4c9 to 7cc2fdc Compare June 24, 2024 15:19
Copy link
Member

@JeremyKuhne JeremyKuhne left a comment

Choose a reason for hiding this comment

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

Added some more comments. I'm a little concerned that we're using TypeName where it isn't necessary in some cases. We should optimize this before we fully validate this as changing it afterwords would be risky.

I still need to spend more time reviewing.

@dotnet-policy-service dotnet-policy-service bot added 📭 waiting-author-feedback The team requires more information from the author and removed 📭 waiting-author-feedback The team requires more information from the author labels Jun 24, 2024
@Tanya-Solyanik Tanya-Solyanik force-pushed the cb-9 branch 2 times, most recently from b670471 to c1e4bcd Compare June 24, 2024 20:37
Copy link
Member

@JeremyKuhne JeremyKuhne left a comment

Choose a reason for hiding this comment

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

We should not be falling into the default interface implementations for our own types that derive from IDataObject.

@dotnet-policy-service dotnet-policy-service bot added 📭 waiting-author-feedback The team requires more information from the author and removed 📭 waiting-author-feedback The team requires more information from the author labels Jun 24, 2024
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 93.00605% with 104 lines in your changes missing coverage. Please review.

Project coverage is 97.03763%. Comparing base (0b07c20) to head (38fd447).
Report is 2 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                  @@
##                main      #11545          +/-   ##
====================================================
+ Coverage   75.91821%   97.03763%   +21.11941%     
====================================================
  Files           3164        1182        -1982     
  Lines         636813      354547      -282266     
  Branches       47008        5410       -41598     
====================================================
- Hits          483457      344044      -139413     
+ Misses        149901        9711      -140190     
+ Partials        3455         792        -2663     
Flag Coverage Δ
Debug 97.03763% <93.00605%> (+21.11941%) ⬆️
integration ?
production ?
test 97.03763% <93.00605%> (-0.01368%) ⬇️
unit ?

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

@Tanya-Solyanik Tanya-Solyanik force-pushed the cb-9 branch 3 times, most recently from 7903b3c to 9f06188 Compare July 24, 2024 21:20
@lonitra lonitra changed the base branch from feature/clipboard to feature/10.0 July 30, 2024 20:12
@lonitra lonitra changed the base branch from feature/10.0 to main August 15, 2024 00:59

namespace System.Windows.Forms;

public interface ITypedDataObject
Copy link
Member

Choose a reason for hiding this comment

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

Is there a resolution to this thread? It still seems our guidance is that both should be implemented.

@Tanya-Solyanik Tanya-Solyanik force-pushed the cb-9 branch 2 times, most recently from dfb875e to 394e1d4 Compare December 10, 2024 01:20
@Tanya-Solyanik Tanya-Solyanik force-pushed the cb-9 branch 2 times, most recently from 3d6a09b to 15a3b48 Compare December 11, 2024 20:31
… for example when the OOB Formatters assembly is not referenced of enabled.
…re, string interpolation in test file; simplify code to read forwarded from attribute
generate TYpeName taking into account what assembly the type was forwarded from

if (dataObject is not ITypedDataObject typedDataObject)
{
// TODO (TanyaSo): localize string
Copy link
Member

Choose a reason for hiding this comment

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

Assuming this will be done in follow up PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@JeremyKuhne JeremyKuhne dismissed their stale review December 12, 2024 00:29

My issues are addressed, letting @lonitra do the final sign-off.

Copy link
Member

@lonitra lonitra left a comment

Choose a reason for hiding this comment

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

LGTM, nice! 🚀

@Tanya-Solyanik Tanya-Solyanik marked this pull request as ready for review December 12, 2024 00:54
@Tanya-Solyanik Tanya-Solyanik requested a review from a team as a code owner December 12, 2024 00:54
@Tanya-Solyanik Tanya-Solyanik merged commit f091e7b into dotnet:main Dec 12, 2024
8 checks passed
@Tanya-Solyanik Tanya-Solyanik deleted the cb-9 branch December 12, 2024 00:55
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview1 milestone Dec 12, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
draft draft PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add GetData<T> Method to Clipboard
4 participants