Open lonitra opened 2 weeks ago
Attention: Patch coverage is 97.30640%
with 8 lines
in your changes missing coverage. Please review.
Project coverage is 74.45358%. Comparing base (
5cefc3d
) to head (3863b46
). Report is 6 commits behind head on feature/clipboard.
Related: https://github.com/dotnet/winforms/issues/11368
This is a start to support JSON serialization in OLE scenarios.
JsonData<T>
: This is our wrapper class that holds the JSON serialized data along with the original type information. Note that the data that is being JSON serialized uses default JsonSerializer behavior. Users can follow the remarks of the public APIs if custom JSON serialization behavior is needed.Public APIs:
DataObject.SetDataAsJson()
- Allows users to add data toDataObject
that will be JSON serialized. This is how we support JSON serialization for drag/drop scenario.Clipboard.SetDataAsJson()
- Allows users to conveniently JSON serialize a type onto the clipboard, but note that this does not acceptDataObject
being passed in. If users want to place aDataObject
on the clipboard, users should ensure data they want to be JSON serialized is already in theDataObject
by utilizingDataObject.SetDataAsJson
and then useClipboard.SetDataObject()
.Tests:
JsonData<T>
JsonData<T>
not existing in .NET 8. More investigation needs to be done here.JsonSerializer
uses reflection to serialize by default, which will not be available when trimming is turned on. We will need to either use source generator APIs to support trimming or configure JsonSerializerOptions.TypeInfoResolverMicrosoft Reviewers: Open in CodeFlow