473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

open .net 2.0 serialized object with .net 1.1

Is there a way to open files with .net 1.1 versions of my software product
that were serialized with a .net 2.0 version of same product? Right now, as
soon as my older .net 1.1 application tries to read the stream, an exception
is thrown. The code to read the stream looks like this:

BinaryFormatter bf = new BinaryFormatter();
bf.AssemblyFormat = FormatterAssemblyStyle.Simple;
IFormatter formatter = bf;
FileStream stream = new FileStream(this.fileName, FileMode.Open,
FileAccess.Read, FileShare.Read);
object list = formatter.Deserialize(stream);
stream.Close();

the objects being serialized all have the [Serializable] attribute and are
serialized with ISerializable.GetObjectData and deserialized with the
special object constructor with the SerializationInfo and StreamingContext
parameters.

Thanks,

Dennis
Nov 26 '05 #1
2 1912
Dennis,

What exception is being thrown? What are the details?

If you are running the same code, and the serialized type is the same
(meaning, you didn't re-compile it), then it ^should^ work. However, if you
re-compiled the type, then the type signature is most likely different, and
you will more than likely have problems de-serializing it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dennis C. Drumm" <dc******@community.nospam> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
Is there a way to open files with .net 1.1 versions of my software product
that were serialized with a .net 2.0 version of same product? Right now,
as soon as my older .net 1.1 application tries to read the stream, an
exception is thrown. The code to read the stream looks like this:

BinaryFormatter bf = new BinaryFormatter();
bf.AssemblyFormat = FormatterAssemblyStyle.Simple;
IFormatter formatter = bf;
FileStream stream = new FileStream(this.fileName, FileMode.Open,
FileAccess.Read, FileShare.Read);
object list = formatter.Deserialize(stream);
stream.Close();

the objects being serialized all have the [Serializable] attribute and are
serialized with ISerializable.GetObjectData and deserialized with the
special object constructor with the SerializationInfo and StreamingContext
parameters.

Thanks,

Dennis

Nov 28 '05 #2
Thanks Nicholas,

I did re-comple it.

Is the change in the type signature something to do with going from .net
framework 1.1 to 2.0 only? I ask becuase I have many version of the
application using .net framework 1.1 and they all can deserialize the files
without problems.

Also, can you point me to some documentation on this situation, something
that explains why the type signature is being changed and what exactly that
implies?

Thanks,

Dennis
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Oj**************@TK2MSFTNGP15.phx.gbl...
Dennis,

What exception is being thrown? What are the details?

If you are running the same code, and the serialized type is the same
(meaning, you didn't re-compile it), then it ^should^ work. However, if
you re-compiled the type, then the type signature is most likely
different, and you will more than likely have problems de-serializing it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dennis C. Drumm" <dc******@community.nospam> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
Is there a way to open files with .net 1.1 versions of my software
product that were serialized with a .net 2.0 version of same product?
Right now, as soon as my older .net 1.1 application tries to read the
stream, an exception is thrown. The code to read the stream looks like
this:

BinaryFormatter bf = new BinaryFormatter();
bf.AssemblyFormat = FormatterAssemblyStyle.Simple;
IFormatter formatter = bf;
FileStream stream = new FileStream(this.fileName, FileMode.Open,
FileAccess.Read, FileShare.Read);
object list = formatter.Deserialize(stream);
stream.Close();

the objects being serialized all have the [Serializable] attribute and
are serialized with ISerializable.GetObjectData and deserialized with the
special object constructor with the SerializationInfo and
StreamingContext parameters.

Thanks,

Dennis


Nov 29 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
0
by: Pierre | last post by:
Hi, I'm trying to select specific nodes from a XmlDocument filled with a serialized object and to insert these nodes into another XmlDocument. The object is well serialized (see below). From a...
5
by: EqDev | last post by:
I have a class that is a control derived from UserControl. I want to use serialization and deserialization with this calss but I get an exception "Cannot serialize member...
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.