Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / February 2007

Tip: Looking for answers? Try searching our database.

Deserialization type load exception even when using a serialization binder

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
john_smith_677@hotmail.com - 30 Jan 2007 21:52 GMT
Hi,

I moved some code from my project to a separate assembly.  I have some
saved definitions that were saved using regular .net serialization.  
When trying to open the saved definitions, I get type load
exceptions.  I am getting around this by implementing my own
SerializationBinder and forwarding the typenames to the new assembly.  
I successfully forward all the types but yet I still get a type load
exception later on in the deserialization.  It seems the formatter is
still referencing the old type name instead of the forwarded one.  I
should also mention that the type that generates the error is a
parameter to another type which is generic.  I can't think of a way
around this and so I can't open any saved definitions right now.  I'm
hoping one of you guys knows a solution.

Here's the stack trace of the framework part of the exception:
  at System.Reflection.Assembly.GetType(String name, Boolean
throwOnError, Boolean ignoreCase)
  at System.UnitySerializationHolder.GetRealObject(StreamingContext
context)
  at
System.Runtime.Serialization.ObjectManager.ResolveObjectReference(Objec
tHolder holder)
  at System.Runtime.Serialization.ObjectManager.DoFixups()
  at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize
(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck,
Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
  at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserial
ize(Stream serializationStream, HeaderHandler handler, Boolean fCheck,
Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
  at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserial
ize(Stream serializationStream)

Thanks
Laura T. - 31 Jan 2007 16:28 GMT
Are you sure your BindToType is getting the new type from the correct
assembly?
It might help to see the code.

> Hi,
>
[quoted text clipped - 33 lines]
>
> Thanks
john_smith_677@hotmail.com - 02 Feb 2007 15:52 GMT
It turns out that one of the saved objects had an instance field of
system.type that points to one of the old types.  That's why it wasn't
going through the serialization binder.

Thanks for you help.

> Are you sure your BindToType is getting the new type from the correct
> assembly?
[quoted text clipped - 39 lines]
>
> > Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.