Broken serialization

C

Chukkalove

I've had to change a class within an application.
The previous developer used serialization to store objects to file. He didnt
use ISerializable interface and even if he had.....
I just dont trust or like using serialization just for the reasons Im asking
for help about.
He used binary serialization, and Im getting errors when the file is read
from disk as the class has changed.
I need to be able to read files created with previous versions of this
software.

I added IDeserializable to try to diagnose the problem, but the deserialize
call fails at bfSkin.Deserialize and my callback to OnDeserialization is
never called.
Is there anything that i can do to step through the deserialization of my
object so that I could at least have a go at fixing it please?


FileStream fsSkin = new FileStream(sFileName, FileMode.Open);

BinaryFormatter bfSkin = new BinaryFormatter();

// Deserialize the object graph

rSkinFile=null;

try

{

rSkinFile = (SkinFile) bfSkin.Deserialize(fsSkin);
 
C

Chukkalove

Thanks for replying Peter
I'll never use serialization by choice. Was bitten before and there are
other ways to do a similar job.
My problem is that I need to be able to find some way to open and convert
files previously written with the serialization that's now broken because
its been very necessary to change the object.

thanks
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top