From 26efa520bcaa3569d9cc1458c4fb3e7a04c13bc3 Mon Sep 17 00:00:00 2001 From: Nicklas Kramer Date: Thu, 4 Dec 2025 10:52:23 +0100 Subject: [PATCH] Packaging: Fixing bad serialization for data types in packages (#21043) * Changing data type serialization to datatype * Moving and correcting comment --- src/Umbraco.Core/Services/EntityXmlSerializer.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Services/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/EntityXmlSerializer.cs index 7c1c374754..013591e678 100644 --- a/src/Umbraco.Core/Services/EntityXmlSerializer.cs +++ b/src/Umbraco.Core/Services/EntityXmlSerializer.cs @@ -214,7 +214,7 @@ internal sealed class EntityXmlSerializer : IEntityXmlSerializer xml.Add(new XAttribute("EditorUiAlias", dataType.EditorUiAlias ?? dataType.EditorAlias)); xml.Add(new XAttribute("Definition", dataType.Key)); xml.Add(new XAttribute("DatabaseType", dataType.DatabaseType.ToString())); - xml.Add(new XAttribute("Configuration", _configurationEditorJsonSerializer.Serialize(dataType.ConfigurationObject))); + xml.Add(new XAttribute("Configuration", SerializeDataTypeConfiguration(dataType))); var folderNames = string.Empty; var folderKeys = string.Empty; @@ -708,4 +708,14 @@ internal sealed class EntityXmlSerializer : IEntityXmlSerializer } } } + + /// + /// We have two properties containing configuration data: + /// 1. ConfigurationData - a dictionary that contains all the configuration data stored as key/value pairs. + /// 2. ConfigurationObject - a strongly typed object that represents the configuration data known to the server. + /// To fully be able to restore the package, we need to serialize the full ConfigurationData dictionary, not + /// just the configuration properties known to the server. + /// + private string SerializeDataTypeConfiguration(IDataType dataType) => + _configurationEditorJsonSerializer.Serialize(dataType.ConfigurationData); }