Breaking Change T1263793
Visible to All Users

Component changes due to the deprecation of BinaryFormatter

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.

See Also

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.