Breaking Change BC4916
Visible to All Users

System.Object type properties: Deserialization-related changes

Updated on April 27, 2023

Applies to v23.1.2+, v22.2.6+, v22.1.9+.

Properties that are not (de)serialized:

  • Data Editors (DevExpress.XtraEditors.ChartRangeControlClientDataProvider.DataSource)
  • Pivot Grid (DevExpress.XtraPivotGrid.PivotSummaryFilter.StartValueInternal)
  • Pivot Grid (DevExpress.XtraPivotGrid.PivotSummaryFilter.StartValueInternal)
  • Scheduler (DevExpress.XtraScheduler.Reporting.TimeCellsControlBase.HtmlImages)
  • Vertical Grid (DevExpress.XtraVerticalGrid.Rows.RowProperties.Value)

The following properties are (de)serialized if they contain simple data types:

  • DevExpress.XtraPrinting.NativeBricks.ToggleSwitchTextBrick.TextValue
  • DevExpress.XtraPrinting.NativeBricks.CheckBoxTextBrick.TextValue
  • DevExpress.XtraPrinting.TextBrick.TextValue
  • DevExpress.XtraPrinting.TrackBarBrick.TextValue
  • DevExpress.XtraPrinting.ProgressBarBrick.TextValue

IMPORTANT

.NET Desktop controls now automatically detect potentially unsafe data types and block deserialization (v19.1+).

As part of this security-related enhancement, we also modified (de)serialization-related behavior for the following settings:

Automatically (de)serialize System.Object type properties for simple data types

Some controls (de)serialize their associated Tag property when they contain the following data types:

Affected controls

  • Data Grid (GridSummaryItem.Tag,  GridColumn.Tag,  BaseView.Tag)
  • Tree List (TreeListColumn.Tag)
  • Pivot Grid (PivotGridCustomTotalBase.Tag,  PivotGridFieldBase.Tag)
  • Chart Control (ChartElement.Tag,  SeriesPoint.Tag)
  • DiagramControl (IDiagramItem.Tag)
  • Reports (Parameter.Tag, XRControl.Tag, XRPageBreak.Tag, XRSubreport.Tag)
  • Editors (FormatRuleBase.Tag)
  • TreeMap and Sunburst Controls (TreeMapItem.Tag, SunburstItem.Tag)
  • Vertical Grid (BaseRow.Tag)
  • NavBar Control (NavElement.Tag)

Custom type (de)serialization

If a control's Tag property contains a custom type (any type except those mentioned above), the Tag property is not serialized.
If a Tag property in a saved layout contains a custom type, the Tag property is not deserialized.

(De)Serialization for a custom type is only possible for a string. You can implement a converter (via the IOneTypeObjectConverter interface) that converts a custom type to/from a string. This converter is invoked automatically whenever our (de)serialization mechanism encounters a registered custom type.

The following example illustrates how to create a simple converter and register it:

C#
using DevExpress.Utils.Serializing.Helpers; struct CustomType { public readonly int Value; public CustomType(int value) { this.Value = value; } } public class CustomTypeConverter : IOneTypeObjectConverter { public Type Type { get { return typeof(CustomType); } } public string ToString(object obj) { return ((CustomType)obj).Value.ToString("D"); } public object FromString(string str) { return new CustomType(int.Parse(str)); } } // Register the converter at application startup. ObjectConverter.Instance.RegisterConverter(new CustomTypeConverter());

The attached project illustrates how to (de)serialize a control's Tag property when it stores a custom data type.

Properties that are no longer (de)serialized

  • Tree List (TreeList.RootValue)

How to Revert to Previous Behavior

The previous behavior is no longer available.

See also

WPF "Object" properties: Changes made to deserialization mechanism

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.