-
Notifications
You must be signed in to change notification settings - Fork 998
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
Conversation
e246a67
to
a89070f
Compare
...ndows.Forms/src/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectExtensions.cs
Outdated
Show resolved
Hide resolved
...ndows.Forms/src/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectExtensions.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments.
src/System.Windows.Forms/src/System/Windows/Forms/OLE/ComposedBinder.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/ComposedBinder.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/ComposedBinder.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
816f4c9
to
7cc2fdc
Compare
There was a problem hiding this 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.
src/System.Windows.Forms/src/System/Windows/Forms/BinaryFormat/WinFormsArrayRecordExtensions.cs
Outdated
Show resolved
Hide resolved
...ndows.Forms/src/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectExtensions.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/ComposedBinder.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/ComposedBinder.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
.../System/Windows/Forms/OLE/DataObject.ComposedDataObject.NativeDataObjectToWinFormsAdapter.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/IDataObject.cs
Outdated
Show resolved
Hide resolved
b670471
to
c1e4bcd
Compare
There was a problem hiding this 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
.
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/IDataObject.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. |
7903b3c
to
9f06188
Compare
src/System.Windows.Forms/src/System/Windows/Forms/OLE/Clipboard.cs
Outdated
Show resolved
Hide resolved
...m.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.BinaryFormatUtilities.cs
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.DataStore.cs
Outdated
Show resolved
Hide resolved
|
||
namespace System.Windows.Forms; | ||
|
||
public interface ITypedDataObject |
There was a problem hiding this comment.
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.
...ows.Forms/tests/UnitTests/System/Windows/Forms/BinaryFormatUtilitiesTests.FullCompatScope.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DragDropHelperTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs
Outdated
Show resolved
Hide resolved
...Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.NativeToWinFormsAdapter.cs
Show resolved
Hide resolved
dfb875e
to
394e1d4
Compare
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/NativeToWinFormsAdapterTests.cs
Show resolved
Hide resolved
3d6a09b
to
15a3b48
Compare
… for example when the OOB Formatters assembly is not referenced of enabled.
…riting data to it
…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
src/System.Windows.Forms/src/System/Windows/Forms/Internal/TypeExtensions.cs
Show resolved
Hide resolved
|
||
if (dataObject is not ITypedDataObject typedDataObject) | ||
{ | ||
// TODO (TanyaSo): localize string |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
src/System.Windows.Forms/src/System/Windows/Forms/OLE/DataObject.Composition.Binder.cs
Outdated
Show resolved
Hide resolved
...ystem.Windows.Forms.Primitives/src/System/LocalAppContextSwitches/LocalAppContextSwitches.cs
Outdated
Show resolved
Hide resolved
My issues are addressed, letting @lonitra do the final sign-off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice! 🚀
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 theDataObjec
t class are obsoleted.Microsoft Reviewers: Open in CodeFlow