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

Layout Load not working following upgrade

3 Answers 108 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
Veteran
David asked on 02 Dec 2020, 09:45 AM

Hello

I have upgraded my version from 2019 R3 to 2020 R3 and have found that the GridView layouts saved in the old version will not longer load in the new version.

 

Here is my existing code:

string layout; // loaded from file
PersistenceManager manager = new PersistenceManager();
 byte[] byteArray = Encoding.ASCII.GetBytes(layout);
MemoryStream stream = new MemoryStream(byteArray);
manager.Load(this.RadGridView, stream);

 

When trying to load the layout it fails with:

Exception thrown: 'System.NullReferenceException' in Telerik.Windows.PersistenceFramework.dll Object reference not set to an instance of an object.

 

If have tried enabling AllowCrossVersion, but this then fails with:

Exception thrown: 'System.ArgumentOutOfRangeException' in mscorlib.dll

 

The only way I can get it to work is by following the recommendation in this post Here, it then loads as expected and without any errors:

PersistenceManager manager = new PersistenceManager();
 byte[] byteArray = Encoding.ASCII.GetBytes(this.layout.Replace("Version=2019.3.1023.45", "Version=2020.3.1020.45"));
MemoryStream stream = new MemoryStream(byteArray);
manager.Load(this.RadGridView, stream);

 

This isn't a satisfactory fix in the long run. Could you please advise how I should be handling this?

 

Thanks

Dave

3 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 04 Dec 2020, 07:47 AM

Hi David,

Thank you for the provided details.

I am happy to hear that you have a solution to your scenario. However, using the AllowCrossVersion property to serialize Telerik controls with one version and deserialize them with another version should not throw an exception. Is it possible to isolate this exception in a standalone project and send it back to me for further investigation? This way I could see your set-up and debug it on my side.

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products, quickly just got a fresh new look + new and improved content, including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
David
Top achievements
Rank 1
Veteran
answered on 07 Dec 2020, 08:37 PM

Hi Dinko

After a lot of playing about I seem to have stumbled upon the cause of the problem. 

If I enable AllowCrossVersion in the code (regardless of the Telerik version) I get the System.ArgumentOutOfRangeException exception if the namespace contains 'Telerik'.

So, looking at the file I stream the layout to, this works:

...
<TI K="292053665" N="GridViewPersistence.ColumnProxy, GridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    <TI K="1294883848" N="System.Collections.Generic.List`1[[GridViewPersistence.ColumnProxy, GridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <TI K="-492066725" N="System.Collections.Generic.List`1[[GridViewPersistence.SortDescriptorProxy, GridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <TI K="1587603909" N="System.Collections.Generic.List`1[[GridViewPersistence.GroupDescriptorProxy, GridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <TI K="321830745" N="System.Collections.Generic.List`1[[GridViewPersistence.FilterSetting, GridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
...

 

Whilst this doesn't:

...<TI K="-1839271086" N="TelerikGridViewPersistence.ColumnProxy, TelerikGridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    <TI K="-779981079" N="System.Collections.Generic.List`1[[TelerikGridViewPersistence.ColumnProxy, TelerikGridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <TI K="-1375940021" N="System.Collections.Generic.List`1[[TelerikGridViewPersistence.SortDescriptorProxy, TelerikGridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <TI K="-573867990" N="System.Collections.Generic.List`1[[TelerikGridViewPersistence.GroupDescriptorProxy, TelerikGridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <TI K="200629070" N="System.Collections.Generic.List`1[[TelerikGridViewPersistence.FilterSetting, TelerikGridViewPersistence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
...

 

The problem doesn't occur when AllowCrossVersion is false. I presume that this isn't expected behaviour?

 

In my main solution I had a namespace of Infrastructure.TelerikControls. I have now changed this so that it no longer contains 'Telerik' and everything works as expected. 

 

Regards

 

Dave

0
Dinko | Tech Support Engineer
Telerik team
answered on 10 Dec 2020, 11:57 AM

Hi David,

Thank you for the provided details. I take a further step and investigate this. You are in the right direction. In the internal code, we are searching for the Telerik string to deserialize our assemblies. In your case, you have a Telerik string in your name, which will trigger the execution of our assemblies' methods. This at some point throws an exception and should be improved. That is why I have logged a feedback item inside our Feedback Portal where you can track its progress. Your Telerik Points are updated for bringing this behavior to our attention.

Another approach that you could try is to use the TypeRestored event instead of the AllowCrossVersion property. This way, you can manually restore the type of the deserialized object.

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products, quickly just got a fresh new look + new and improved content, including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
PersistenceFramework
Asked by
David
Top achievements
Rank 1
Veteran
Answers by
Dinko | Tech Support Engineer
Telerik team
David
Top achievements
Rank 1
Veteran
Share this question
or