Custom serialization seems to be ignored  
Author Message
Rolle





PostPosted: .NET Remoting and Runtime Serialization, Custom serialization seems to be ignored Top

Hello, I am trying to use the ISerialization interface to customize how a class is serialized, to be able to open it with another application. This is my getObjectData method:

public void GetObjectData(SerializationInfo info, StreamingContext context)

{

string s = System.Reflection.Assembly.GetExecutingAssembly().FullName;

s = s.Replace("96wellShuttleSW","SerReader");

info.FullTypeName = s;

info.AddValue("author", author);

info.AddValue("authorProfile",authorProfile);

info.AddValue("lastModifier", lastModifier);

info.AddValue("lastModified", lastModified);

info.AddValue("wells", wells);

info.AddValue("fileSettings", fileSettings);

info.AddValue("templateFile", templateFile);

info.AddValue("templateCompleted", templateCompleted);

}

I can see that this method is called by using the de****. However when I manually look at the serialized file, or try to deserialize it, I still see the original assembly name, 96wellShuttleSW. Any idea why my change to FullTypeName is ignored Thanks.



.NET Development22  
 
 
Rolle





PostPosted: .NET Remoting and Runtime Serialization, Custom serialization seems to be ignored Top

OK, the problem seems to be that whenever I have an array of custom classes, the getobjectdata() gets called for each object and writes the new assembly name there, but when the array object itself serializes it writes the old assembly name (SerReader). So as soon as there is an array in my serialized class tree, the assembly name "SerReader" is written into the blob and it can't be opened from the other app. Anyone, is there a way to control how an array is serialized Seems it should be hard as they have no real code implementation as a class.

/ Rolle