What Changed
We migrated from BinaryFormatter as Microsoft deprecated it in .NET 9. This change affects the following functionality:
Copy to Clipboard Operations
Previously, many of our controls placed row values (objects of a custom type) and text (converted from selected rows or cells) onto the clipboard. This means that serializable data objects were passed into the clipboard directly and you could then obtain them using code similar to the following:
C#gridControl1.DataSource = new List<DataObj> {
new DataObj{ ID = 1, Name = "John Smith" }
};
gridView1.SelectAll();
gridView1.CopyToClipboard();
// Then, you could expect that your DataObj objects would be available via the IDataObject API:
IDataObject dataObj = Clipboard.GetDataObject();
ArrayList array = dataObj.GetData(typeof(ArrayList)) as ArrayList;
At present, you cannot obtain clipboard data as described above, you can only obtain text; a Clipboard.GetDataObject().GetData(typeof(ArrayList))
method call will return null. To obtain text, call the Clipboard.GetText
or Clipboard.GetText(TextDataFormat.UnicodeText)
method.
You cannot revert to the previous behavior (except for the Scheduler).
Affected WPF components:
- GridControl
- TreeListControl
- Gantt
- Scheduler. Note that to revert to the previous behavior, you can use the approach described in the next section (enable
EnableDataObjectBinarySerialization
and install the BinaryFormatter compatibility package).
Affected WinForms APIs:
Grids
Editors
Drag & Drop Operations
Drag & Drop operations no longer work because we use DataObject to translate data between affected WPF components (see the list below). In turn, DataObject uses BinaryFormatter
APIs when System.Windows.DataObject.GetData
is called to retrieve data that originated from another component (when/if the type is not intrinsically handled).
To revert to the previous behavior, you can install the BinaryFormatter compatibility package and set the DeserializationSettings.EnableDataObjectBinarySerialization property to true
:
C#namespace DXApplication1 {
public partial class App : Application {
static App() {
DevExpress.Utils.DeserializationSettings.EnableDataObjectBinarySerialization = true;
//...
}
}
}
We expect to update our drag & drop logic and eliminate use of BinaryFormatter in the future.
Affected WPF controls:
Reasons for Change
Starting with .NET 9, Microsoft no longer includes an implementation of BinaryFormatter in its runtime (due to security risks). Although BinaryFormatter APIs are available, their use generates a PlatformNotSupportedException error.
Impact on Existing Apps
If you use any functionality implemented via BinaryFormatter APIs, you will encounter the PlatformNotSupportedException.