Serializing/Deserializing RadTileView

4 posts, 0 answers
  1. Grey
    Grey avatar
    4 posts
    Member since:
    Jul 2008

    Posted 08 Feb 2010 Link to this post

    Hi support,

    I'm needing to store a RadTileView into IsolatedStorage to persist its state across application instances and need to serialize and deserialize the object. Serialization is working fine, but on the Deserialisation .Net is throwing an exception when trying to reflect the ItemsControl type. It's looking like its not resolving the conflicting ItemsControl type name from an empty XML namespace....

    Please see the stack trace below for more information.

    Note, the Dashboard property is a RadTileView with multiple RadTileViewItems (with RadFluidContentControls as their content.).

    Thanks in advance!

    Grey

    InnerException  {System.InvalidOperationException: There was an error reflecting property 'Dashboard'. ---> System.InvalidOperationException: There was an error reflecting type 'Telerik.Windows.Controls.RadTileView'. ---> System.InvalidOperationException: Types 'System.Windows.Controls.ItemsControl' and 'Telerik.Windows.Controls.ItemsControl' both use the XML type name, 'ItemsControl', from namespace ''. Use XML attributes to specify a unique XML name and/or namespace for the type.  
       at System.Xml.Serialization.XmlReflectionImporter.GetTypeMapping(String typeName, String ns, TypeDesc typeDesc, NameTable typeLib, Type type)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)  
       --- End of inner exception stack trace ---  
       at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel parent, FieldModel model, XmlAttributes a, String ns, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)  
       --- End of inner exception stack trace ---  
       at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)  
       at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)}  System.Exception {System.InvalidOperationException}  
     
  2. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 11 Feb 2010 Link to this post

    Hi Grey,

    Excuse me for the delayed response. Can you please send me a sample project that demonstrates the error so that I can investigate it?

    Kind regards,
    Tihomir Petkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Andreas
    Andreas avatar
    21 posts
    Member since:
    Jan 2012

    Posted 21 Mar 2013 Link to this post

    Hello,

    I got the same problem with XMLSerializer and SharpSerializer, that always happens during serialization.
    Partially the Persistence Framework and the LoadLayout/SaveLayout works, but a lot of information get lost by using them.

    The DataContractSerializer and the ProtocollBuffers can't serialize them, its not possible to set the required attributes in closed source classes, so I'm a little lost with this problem.

    I provide the Serialization errors, I've got below.

    Best regards
    Andreas

    ------------------------------------
    XMLSerializer=> Deserialization
    ------------------------------------
    System.Xml.Serialization.XmlSerializer s = new System.Xml.Serialization.XmlSerializer(typeof(SSGRadDocking));
    d = s.Deserialize(ms) as SSGRadDocking;

    {System.InvalidOperationException: Fehler beim Reflektieren des Typs 'SSG.KPIMonitor.GUI.Custom.SSGRadDocking'. ---> System.InvalidOperationException: Die Typen 'System.Windows.Controls.ItemsControl' und 'Telerik.Windows.Controls.ItemsControl' verwenden den XML-Typnamen 'ItemsControl' im Namespace ''. Geben Sie mit XML-Attributen einen eindeutigen XML-Namen und/oder Namespace für den Typ an.
       bei System.Xml.Serialization.XmlReflectionImporter.GetTypeMapping(String typeName, String ns, TypeDesc typeDesc, NameTable typeLib, Type type)
       bei System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
       --- Ende der internen Ausnahmestapelüberwachung ---
       bei System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter)
       bei System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
       bei System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
       bei System.Xml.Serialization.XmlSerializer..ctor(Type type)
       bei SSG.KPIMonitor.GUI.Custom.SSGRadDocking.SaveLayoutAsByteArray()
       bei SSG.KPIMonitor.GUI.Custom.SSGRadDocking.set_DockingElementAsByteArray(Byte[] value)
       bei SSG.KPIMonitor.GUI.Custom.SSGRadDocking.ChangeVisualState()
       bei Telerik.Windows.Controls.ItemsControl.OnApplyTemplate()
       bei Telerik.Windows.Controls.RadDocking.OnApplyTemplate()
       bei System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)}



    ------------------------------------
    SharpSerializer => Deserialization
    ------------------------------------
    SharpSerializer ss = new SharpSerializer(true);
    d = ss.Deserialize(ms) as SSGRadDocking;

    {Polenter.Serialization.Core.DeserializingException: An error occured during the deserialization. Details are in the inner exception. ---> System.MethodAccessException: Fehler beim Versuch von Methode "Polenter.Serialization.Deserializing.ObjectFactory.fillProperties(System.Object, System.Collections.Generic.IEnumerable`1<Polenter.Serialization.Core.Property>)", auf Methode "Telerik.Windows.Controls.ItemsControl.set_IsFocused(Boolean)" zuzugreifen.
       bei System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags)
       bei System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, UInt32 invocationFlags)
       bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       bei System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
       bei System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
       bei Polenter.Serialization.Deserializing.ObjectFactory.fillProperties(Object obj, IEnumerable`1 properties)
       bei Polenter.Serialization.Deserializing.ObjectFactory.createObjectFromComplexProperty(ComplexProperty property)
       bei Polenter.Serialization.Deserializing.ObjectFactory.createObjectCore(ReferenceTargetProperty property)
       bei Polenter.Serialization.Deserializing.ObjectFactory.CreateObject(Property property)
       bei Polenter.Serialization.SharpSerializer.Deserialize(Stream stream)
       --- Ende der internen Ausnahmestapelüberwachung ---
       bei Polenter.Serialization.SharpSerializer.Deserialize(Stream stream)
       bei SSG.KPIMonitor.GUI.Custom.SSGRadDocking.OnByteArrayChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
       bei System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
       bei System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       bei System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
       bei System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       bei SSG.KPIMonitor.GUI.Custom.SSGRadDocking.set_DockingElementAsByteArray(Byte[] value)}
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 25 Mar 2013 Link to this post

    Hi Andreas,

     Could you please elaborate more on your exact scenario? Particularly:

    • which Telerik control you are trying to serialize ?
    • which of the control's properties you are not able to serialize ?
    • what are the exact issues with the RadPersistenceFramework ?
    Is it possible for you to send us an isolated sample replicating your issues in a new support thread ? This way we would be better able to investigate your scenario. Thank you in advance for your cooperation.
    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top