dotnet / dotnet/wpf

Avoid serialization for in-process DataObject use

Open
#10,776 1 comment 0 reactions 0 assignees View on GitHub
area-clipboard
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

Historically putting data on the Clipboard and retrieving it would go through the native OLE IDataObject interface, which would have the side effect of always making all interaction be `autoConvert == true`.

The new implementation does not need to go through the serialization that would happen here but does need to follow the behavior above. We initially handled this by forcing some scenarios through the proxy, but that causes serialization. In WinForms this was handled via a derived `DataObject` class, which we've just updated to just mimic the behavior from before.
 
https://github.com/dotnet/winforms/pull/13287

`DataObject` is sealed in WPF, so this behavior was done with:

``` C#
private readonly bool _doNotUnwrap;
```

This should be changed to `_forceAutoConvert` to follow the behavior change that WinForms does.

Then we'll be able to enable customer OLE scenarios that are only in process and don't set `copy` to `true` without needing to take the `BinaryFormatter` compat package.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.