This is a migrated thread and some comments may be shown as answers.

NotSupportedException: XLinq on ListSortDirection deserializing RadGridView

5 Answers 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 23 Apr 2014, 03:16 PM
I have serialized a RadGridView by applying PersistenceManager.Save(control).
Afterwards it is stored in IsolatedStorageSettings.

After retrieval, when trying to deserializing it, I get the following exception:
System.InvalidOperationException: There is an error in XML document (145, 8). ---> System.NotSupportedException: XLinq

The XML as such seems correct.
It boils down to the following element in the SerializationString. When left out it works again.
       <PV Key="49" TypeKey="840667292">
           <Value xsi:type="ListSortDirection">Ascending</Value>
       </PV>

There is also an ICustomPropertyProvider involved. I can imagine that is relevant.

As far as I know this feature has worked for quite some time including the sorting.
All of a sudden we have this problem. I do not see changes in our code that could be the cause.

So, what is going on?
Have we caused this some way? Do you have some advice to fix an error on our side?
Is this a bug? Do you have a workaround? Can you please fix it?

See below for more details. (I would have preferred to have been able to attach them as files)

----------------------------

System.InvalidOperationException: There is an error in XML document (94, 8). ---> System.NotSupportedException: XLinq
   bij System.Xml.Serialization.XmlSerializationReader.ReadXmlNodes(Boolean elementCanBeType)
   bij System.Xml.Serialization.XmlSerializationReader.ReadTypedPrimitive(XmlQualifiedName type, Boolean elementCanBeType)
   bij System.Xml.Serialization.XmlSerializationReader.ReadTypedPrimitive(XmlQualifiedName type)
   bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderData.Read1_Object(Boolean isNullable, Boolean checkType)
   bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderData.Read3_PrimitiveValue(Boolean isNullable, Boolean checkType)
   bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderData.Read6_Data(Boolean isNullable, Boolean checkType)
   bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderData.Read7_Data()
   --- Einde van intern uitzonderingsstackpad ---
   bij System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, Object events)
   bij System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
   bij System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
   bij MyCompany.MyProduct.Presentation.Common.CompositionUtilities.ViewPersister.ColumnsConsistent(String persistenceString, RadGridView targetGridView)
   bij MyCompany.MyProduct.Presentation.Common.CompositionUtilities.ViewPersister.RestoreState(String parentName, Control targetControl)
   bij MyCompany.MyProduct.Presentation.Common.Gui.Views.OverviewView.RestoreGuiState()
   bij MyCompany.MyProduct.Presentation.Common.Modules.WindowBase.SetGuiState()
   bij MyCompany.MyProduct.Presentation.Common.Modules.WindowBase.OnImportsSatisfied()
   bij MyCompany.MyProduct.Presentation.Common.Modules.Windows.EntityOverviewWindow`1.OnImportsSatisfied()
   bij System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.NotifyImportSatisfied()

---------------------

<?xml version="1.0" encoding="utf-16"?>
<Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <T>
    <TI K="-19729228" N="Telerik.Windows.Controls.RadGridView, Telerik.Windows.Controls.GridView, Version=2012.3.1017.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
    <TI K="1069696138" N="System.String, mscorlib, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
    <TI K="1371949114" N="System.Int32, mscorlib, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
    <TI K="526171157" N="Telerik.Windows.Controls.GridViewLength, Telerik.Windows.Controls.GridView, Version=2012.3.1017.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
    <TI K="634479130" N="Telerik.Windows.Controls.GridView.GridViewLengthConverter, Telerik.Windows.Controls.GridView, Version=2012.3.1017.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
    <TI K="-388248171" N="MyCompany.MyProduct.Presentation.Common.UserControls.Utilities.ColumnProxy, MyCompany.MyProduct.Presentation.Common.UserControls, Version=1.0.1.42, Culture=neutral, PublicKeyToken=null" />
    <TI K="1539131642" N="System.Collections.Generic.List`1[[MyCompany.MyProduct.Presentation.Common.UserControls.Utilities.ColumnProxy, MyCompany.MyProduct.Presentation.Common.UserControls, Version=1.0.1.42, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
    <TI K="840667292" N="System.ComponentModel.ListSortDirection, System, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
    <TI K="-717291203" N="MyCompany.MyProduct.Presentation.Common.UserControls.Utilities.SortDescriptorProxy, MyCompany.MyProduct.Presentation.Common.UserControls, Version=1.0.1.42, Culture=neutral, PublicKeyToken=null" />
    <TI K="1838183955" N="System.Collections.Generic.List`1[[MyCompany.MyProduct.Presentation.Common.UserControls.Utilities.SortDescriptorProxy, MyCompany.MyProduct.Presentation.Common.UserControls, Version=1.0.1.42, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
    <TI K="-747662021" N="System.Collections.Generic.List`1[[MyCompany.MyProduct.Presentation.Common.UserControls.Utilities.GroupDescriptorProxy, MyCompany.MyProduct.Presentation.Common.UserControls, Version=1.0.1.42, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
    <TI K="2137421651" N="System.Collections.Generic.List`1[[MyCompany.MyProduct.Presentation.Common.UserControls.Utilities.FilterSetting, MyCompany.MyProduct.Presentation.Common.UserControls, Version=1.0.1.42, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
  </T>
  <P>
    <PV Key="1" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Name</Value>
    </PV>
    <PV Key="2" TypeKey="1371949114">
      <Value xsi:type="xsd:int">0</Value>
    </PV>
    <PV Key="3" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Auto</Value>
    </PV>
    <PV Key="4" TypeKey="1069696138">
      <Value xsi:type="xsd:string">PhoneNumber</Value>
    </PV>
    <PV Key="5" TypeKey="1371949114">
      <Value xsi:type="xsd:int">1</Value>
    </PV>
    <PV Key="6" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Phone number</Value>
    </PV>
    <PV Key="7" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Warden</Value>
    </PV>
    <PV Key="8" TypeKey="1371949114">
      <Value xsi:type="xsd:int">2</Value>
    </PV>
    <PV Key="9" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Address</Value>
    </PV>
    <PV Key="10" TypeKey="1371949114">
      <Value xsi:type="xsd:int">3</Value>
    </PV>
    <PV Key="11" TypeKey="1069696138">
      <Value xsi:type="xsd:string">PostalCode</Value>
    </PV>
    <PV Key="12" TypeKey="1371949114">
      <Value xsi:type="xsd:int">4</Value>
    </PV>
    <PV Key="13" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Postal code</Value>
    </PV>
    <PV Key="14" TypeKey="1069696138">
      <Value xsi:type="xsd:string">City</Value>
    </PV>
    <PV Key="15" TypeKey="1371949114">
      <Value xsi:type="xsd:int">5</Value>
    </PV>
    <PV Key="16" TypeKey="1069696138">
      <Value xsi:type="xsd:string">District</Value>
    </PV>
    <PV Key="17" TypeKey="1371949114">
      <Value xsi:type="xsd:int">6</Value>
    </PV>
    <PV Key="18" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Region</Value>
    </PV>
    <PV Key="19" TypeKey="1371949114">
      <Value xsi:type="xsd:int">7</Value>
    </PV>
    <PV Key="20" TypeKey="1069696138">
      <Value xsi:type="xsd:string">OrganizationName</Value>
    </PV>
    <PV Key="21" TypeKey="1371949114">
      <Value xsi:type="xsd:int">8</Value>
    </PV>
    <PV Key="22" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Organization</Value>
    </PV>
    <PV Key="23" TypeKey="1069696138">
      <Value xsi:type="xsd:string">DevicesFormatString</Value>
    </PV>
    <PV Key="24" TypeKey="1371949114">
      <Value xsi:type="xsd:int">9</Value>
    </PV>
    <PV Key="25" TypeKey="1069696138">
      <Value xsi:type="xsd:string">Scheme Id</Value>
    </PV>
    <PV Key="26" TypeKey="840667292">
      <Value xsi:type="ListSortDirection">Ascending</Value>
    </PV>
  </P>
  <R>
    <RV Key="50841847" IsRoot="true" TypeKey="-19729228">
      <D>
        <PD PN="Columns" VK="0" RK="48819313" TK="1539131642" TCK="0" />
        <PD PN="SortDescriptors" VK="0" RK="44550533" TK="1838183955" TCK="0" />
        <PD PN="GroupDescriptors" VK="0" RK="51823384" TK="-747662021" TCK="0" />
        <PD PN="FilterDescriptors" VK="0" RK="63757280" TK="2137421651" TCK="0" />
      </D>
    </RV>
    <RV Key="36720633" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="1" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="2" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="1" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="48819313" IsRoot="false" TypeKey="1539131642">
      <D>
        <PD PN="Columns[]" VK="0" RK="36720633" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="62050241" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="21581258" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="60013597" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="3251468" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="29263214" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="62042342" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="21510172" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="59373825" TK="-388248171" TCK="0" />
        <PD PN="Columns[]" VK="0" RK="64602382" TK="-388248171" TCK="0" />
      </D>
    </RV>
    <RV Key="62050241" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="4" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="5" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="6" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="21581258" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="7" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="8" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="7" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="60013597" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="9" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="10" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="9" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="3251468" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="11" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="12" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="13" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="29263214" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="14" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="15" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="14" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="62042342" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="16" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="17" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="16" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="21510172" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="18" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="19" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="18" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="59373825" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="20" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="21" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="22" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="64602382" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="UniqueName" VK="23" RK="0" TK="1069696138" TCK="0" />
        <PD PN="DisplayOrder" VK="24" RK="0" TK="1371949114" TCK="0" />
        <PD PN="Header" VK="25" RK="0" TK="1069696138" TCK="0" />
        <PD PN="Width" VK="3" RK="0" TK="526171157" TCK="634479130" />
      </D>
    </RV>
    <RV Key="65410477" IsRoot="false" TypeKey="0">
      <D>
        <PD PN="ColumnUniqueName" VK="1" RK="0" TK="1069696138" TCK="0" />
        <PD PN="SortDirection" VK="26" RK="0" TK="840667292" TCK="0" />
      </D>
    </RV>
    <RV Key="44550533" IsRoot="false" TypeKey="1838183955">
      <D>
        <PD PN="SortDescriptors[]" VK="0" RK="65410477" TK="-717291203" TCK="0" />
      </D>
    </RV>
  </R>
</Data>





5 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 28 Apr 2014, 07:18 AM
Hi,

You can check our recent GridView Serialization demo showing how to save and load settings using the PersistenceFramework. You can check the code related to SortDescriptors.

Let me know how this approach works for you. 

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Robert
Top achievements
Rank 1
answered on 28 Apr 2014, 09:38 AM
Dear Didie,

Excuse me, this does not help me. As described, we already had a WORKING siuation, so it is no matter of tutorials and starting up.

What I do hope is that you can tell me what is going wrong in the XML I supplied to you, to start with.

Please answer the following questions
- What exactly is the problem in the XML?
- What should the XML be to make it working. Possibly enabling me to apply a hack on that to fix it.
- Is this a bug in the Telerik part? If so, please fix it.

Thanks,
Robert
0
Accepted
Dimitrina
Telerik team
answered on 28 Apr 2014, 11:47 AM
Hello Robert,

I understand your solution works fine except for this exception.
The case is we are not aware of such an exception. There is also not such an error when persisting the SortDescriptors on our online demo.

As to your questions:
- What exactly is the problem in the XML?
It seems this is a valid xml.
- What should the XML be to make it working. Possibly enabling me to apply a hack on that to fix it.
We cannot reproduce such an issue at our end.
- Is this a bug in the Telerik part? If so, please fix it.
We cannot reproduce such an issue at our end.
You can find attached the demo project we used to test on. 

May I ask you to confirm the version of the assemblies you have referred? Are all they with the same version?

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Robert
Top achievements
Rank 1
answered on 05 May 2014, 07:53 AM
Hi Didie,

First an addition I was not accurate about. The deserialization I spoke of was an additional one I explicitly did for analysis of the content by an XmlSerializer on Data.

The solution turned out to be by a pretty minor change by adding the extraTypes parameter on the XmlSerializer constructor for the ListSortDirection type that the deserialization tripped over. So, we ended up having:
new XmlSerializer(typeof(Data), new[] { typeof(ListSortDirection) })

It remained surprising that this problem did not occur previously.

Consider this solved.

Thanks,
Robert

0
Dimitrina
Telerik team
answered on 05 May 2014, 01:37 PM
Hello Robert,

I am glad to hear you find out the cause of the issue.
Thank you for updating us and sharing the solution.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Robert
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Robert
Top achievements
Rank 1
Share this question
or