471,353 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,353 software developers and data experts.

Deserialization when moving folders

I am using a C# project in .NET and am running into a problem with
deserialization. Previously I have serialized and deserialized these
objects without any problems. However I recently moved some classes
from one assembly to another. This is causing the serialization routine
to be unable to resolve the types saved with the old version of the
code. The error I get is:

Type not resolved for member Foo.Bar.Class1, OldAssembly,
Version=1.0.0.1, Culture=neutral, PublicKeyToken=abcdef123456

The difference is I've moved the class from OldAssembly to NewAssembly.

I have seen an example of someone modifying type and assembly
information at serialization time in an old post, like so:

/// <summary>
/// Method to Serialize object
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
[SecurityPermission(SecurityAction.Demand,
SerializationFormatter=true)]
public void GetObjectData(SerializationInfo info, StreamingContext
context)
{
info.FullTypeName = "Framework.Server.Configuration";
info.AssemblyName = "Framework.Server.BusinessContext";
[...]
}

However this method still required the user to serialize the full
assembly name, which is my case is now different.

I am sure someone has run into this problem before. Does anyone have a
solution for this? I am wondering if I need to do something with type
converters, or change how I save things with the old code so that the
new code can resolve the type.

Jul 21 '05 #1
0 803

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Snowman | last post: by
3 posts views Thread by Amadelle | last post: by
3 posts views Thread by AnkitAsDeveloper [Ankit] | last post: by
3 posts views Thread by umbertoeklat | last post: by
3 posts views Thread by parrot toes | last post: by
reply views Thread by Sean McFee | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.