What Changed
Microsoft deprecated BinaryFormatter in .NET 9. The impact of this decision and modifications we made as a result of this change impacts/affects the following capabilities:
Copy to Clipboard
Previously, many DevExpress WPF controls placed row values (custom type objects) and text (converted from selected rows or cells) onto the clipboard. This means that serializable data objects were passed onto the clipboard, allowing you to 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.
At present, you cannot obtain clipboard data as described above (you can only obtain text values). A Clipboard.GetDataObject().GetData(typeof(ArrayList))
method call will return null. To obtain text, call the Clipboard.GetText
or Clipboard.GetText(TextDataFormat.UnicodeText)
method instead.
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
If using v24.1.8 and 24.2.2, Drag & Drop operations no longer work because DevExpress WPF UI controls use DataObject
to translate data between 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 type is not intrinsically handled).
Note: Drag & Drop operations within the same application are available for v24.1.11 through 24.2.6. You need to update your project to these versions or newer. Alternatively, use the compatibility package as documented below.
Drag & Drop Behavior in Different Versions
Versions | Description |
---|---|
24.2.1 / 24.1.7 and earlier | Drag & Drop operations are available |
24.2.2-24.2.5 / 24.1.8-24.1.10 | Drag & Drop operations are not available |
24.2.6 / 24.1.11 and newer | Drag & Drop operations are available within the same application only |
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 the use of BinaryFormatter in the future.
Affected WPF controls:
- GridControl
- TreeListControl
- ListBoxEdit
- Gantt
- Scheduler and legacy Scheduler
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 a PlatformNotSupportedException.