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

PersistenceManager.LoadFromXml vs Assembly Versions

7 Answers 240 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
Koen
Top achievements
Rank 1
Koen asked on 31 Jul 2012, 08:23 AM
Hi All,


We use Telerik's PersistenceManager capabilities to save user settings to XML in a relational database (as desribed here).
In particular, some of RadGridView's settings are stored this way.
This has worked fine for several months, until we performed an update of our Telerik libraries last week.


The XML the PersistenceManager produces, contains some type information concerning the types that were serialized to XML,
and contains lines like this:

<TI K="-134624143" N="Telerik.Windows.Controls.GridView.GridViewLengthConverter, Telerik.Windows.Controls.GridView, Version=2011.2.712.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />

After the Telerik libraries update, this causes an exception because we now use Telerik.Windows.Controls.GridView v2012... 
When PersistenceManager.LoadFromXml is called, the PersistenceFramework tries to load the Type,
resulting in a TypeLoadException:

Could not load file or assembly 'Telerik.Windows.Controls.GridView,
Version=2011.2.712.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one
of its dependencies. The located assembly's manifest definition does not match
the assembly reference. (Exception from HRESULT: 0x80131040)


What is the best option to avoid this on Telerik updates?
Can we tell the Serializer not to Save the fully qualified type name to XML?


Thanks for your time,
Koen




7 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 03 Aug 2012, 07:19 AM
Hi Koen,

 Basically, the full assembly qualifying name is required to be saved, as there is no way to restore the type when deserializing. However, it is possible to change only the version of the type. We have already resolved this issue so that the PersistenceManager can support cross version deserialization. This should be available with the next internal build.

Regards,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alfons
Top achievements
Rank 2
answered on 05 Oct 2012, 09:49 AM
Dear Alex,

The issue you are referring to is a Silverlight issue. Is this cross version deserialization available for WPF as well?

Regards,

Alfons

BTW In the PIT I cannot discover a date when the issue is solved, only when is submitted. I would like to see when the last changes where made to an issue, to get an idea if there has been any progress to an issue lately.
0
Tina Stancheva
Telerik team
answered on 10 Oct 2012, 10:01 AM
Hello Alfons,

The issue is resolved for both Silverlight and WPF. It was resolved on 06.08.2012 so you can use it with the latest official release - Q2 2012 SP2 (v. 2012.2.0912).

Also, thank you for your feedback on our PITS. We will definitely have it in mind when discussing how to improve the system.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jeff
Top achievements
Rank 1
answered on 06 Mar 2013, 05:56 PM
Tina,

You mentioned that this has been resolved as of 2012.2.0912 however after upgrading to Q1 2013 I'm seeing the following exception when attempting to load perseistent state for a RadGridView control saved in 2012.2.0912. Please note that we have also switched from .NET 3.5 to .NET 4.0 in this process as well. I'm I missing some details on how get this working or is my understanding on how this was resolved incorrect?


System.IO.FileLoadException occurred
  HResult=-2146234304
  Message=Could not load file or assembly 'Telerik.Windows.Controls.GridView, Version=2012.2.912.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=mscorlib
  FileName=Telerik.Windows.Controls.GridView, Version=2012.2.912.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7
  FusionLog==== Pre-bind state information ===
LOG: User = MyDomain\MyUser
LOG: DisplayName = Telerik.Windows.Controls.GridView, Version=2012.2.912.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7
 (Fully-specified)
LOG: Appbase = file:///C:/MySolution/MyProject/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Telerik.Windows.PersistenceFramework, Version=2013.1.220.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\MySolution\MyProject\bin\Debug\SmartClient.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Telerik.Windows.Controls.GridView, Version=2012.2.912.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7
LOG: Attempting download of new URL file:///C:/MySolution/MyProject/bin/Debug/Telerik.Windows.Controls.GridView.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

  StackTrace:
       at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
       at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
       at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
       at System.Type.GetType(String typeName)
       at Telerik.Windows.Persistence.Serialization.Deserializer.RestoreType(String typeName) in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Frameworks\Persistence\Serialization\Deserializer.cs:line 783
  InnerException:

0
Koen
Top achievements
Rank 1
answered on 07 Mar 2013, 09:40 AM
We are also still experiencing the same issue in WPF version 2012.3.12.03.40.


Regards,
Koen 
0
Zarko
Telerik team
answered on 11 Mar 2013, 01:59 PM
Hello Jeff,
The Persistence Framework saves the dll name and version for each type so that it could load them afterwards and this may cause some problems. With Q2 2012 SP2 (v. 2012.2.0912) we added a new property - AllowCrossVersion and if you set it to True it should fix this issue for our dlls, but it doesn't work for Microsoft dlls! This means that if you've persisted something with 3.5 you'll still need 3.5 installed when you try to load it because the persistence will try to load the older dlls.
I'd like to ask you for a sample project so that we could test it and give you a workaround or fix if possible.
I've attached a sample .NET 4.0 project with an XML file which is saved under .NET 3.5 and with older telerik version (2012.2.912.35) but if you load it everything should work fine so could you please examine it and tell us if it works on your side.

Regards,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Zarko
Telerik team
answered on 11 Mar 2013, 02:09 PM
Hi Koen,
I'd like to ask you for some more information about your case and also could you please examine the attached project from my previous post and see if it helps you?
We're looking forward to hearing from you.

Greetings,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
PersistenceFramework
Asked by
Koen
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Alfons
Top achievements
Rank 2
Tina Stancheva
Telerik team
Jeff
Top achievements
Rank 1
Koen
Top achievements
Rank 1
Zarko
Telerik team
Share this question
or