From 8013a5fb696581abbf814feff6cae10f49e55872 Mon Sep 17 00:00:00 2001 From: Dmitry Dzygin Date: Fri, 25 Mar 2022 14:18:43 +0100 Subject: [PATCH] CompositeSerializationBinder - fixing a backward compatibility issue --- .../CompositeSerializationBinder.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Composite/Core/Serialization/CompositeSerializationBinder.cs b/Composite/Core/Serialization/CompositeSerializationBinder.cs index bf66bd027..987401fc4 100644 --- a/Composite/Core/Serialization/CompositeSerializationBinder.cs +++ b/Composite/Core/Serialization/CompositeSerializationBinder.cs @@ -1,6 +1,7 @@ using System; using System.Reflection; using System.Runtime.Serialization; +using Composite.C1Console.Elements; using Composite.C1Console.Security; using Composite.Core.Types; using Composite.Data; @@ -42,15 +43,17 @@ public override Type BindToType(string assemblyName, string typeName) if (result != null) return result; } - if (!TypeIsSupported(assemblyName, typeName)) + var type = base.BindToType(assemblyName, typeName); + + if (!TypeIsSupported(assemblyName, typeName, type)) { - throw new NotSupportedException("Not supported object type"); + throw new NotSupportedException($"Not supported object type '{typeName}'"); } - return base.BindToType(assemblyName, typeName); + return type; } - private bool TypeIsSupported(string assemblyName, string typeName) + private bool TypeIsSupported(string assemblyName, string typeName, Type type) { assemblyName = new AssemblyName(assemblyName).Name; @@ -65,11 +68,13 @@ private bool TypeIsSupported(string assemblyName, string typeName) } } - var type = base.BindToType(assemblyName, typeName); return type != null && (type.IsEnum || typeof(EntityToken).IsAssignableFrom(type) - || typeof(IDataId).IsAssignableFrom(type)); + || typeof(SearchToken).IsAssignableFrom(type) + || typeof(IDataId).IsAssignableFrom(type) + || type == typeof(DataSourceId) + || type == typeof(DataScopeIdentifier)); } } }