serialize ?

  • Thread starter Thread starter Cyang
  • Start date Start date
C

Cyang

Hi all,
When I serialize a class which is serializable to a file in one
project.Then in another project,when I deserialize the file which is
serialized in first project,system throw a exception. this exception is
mainly about namespace can't read.
Excuse me,Please tell me how to resolve it.

Thanks & Regards,
 
Hi
When I serialize a class which is serializable to a file in one
project.Then in another project,when I deserialize the file which is
serialized in first project,system throw a exception. this exception is
mainly about namespace can't read.
Excuse me,Please tell me how to resolve it.

I had the same problem sending serialized data over the network. The best
way to solve this is to put the class you're going to serialize into a
separate dll (create a class library project in VS.NET), and add it as a
reference to both your other projects. The serialization problems are not
only due to different class types, even if you make them the same, the
problem is that you have two different versions of the class, one in each of
your projects, and if they are not exactly the same, deserialization will
never work properly.

Regards
Stephan
 
Hi Cyang,
In order to desearialization to work. The assembly, which contains the class
should be available for loading. which menas the DLL has to be in the
probing directories for the application traying to deserialize the class or
in the GAC. There should be version match as well . It would be error if you
try to serialize a class from assembly with one version and deserialize it
later using class in assembly with different version (maybe even culture).

So check if the assembly is available for loading for the second application
and whether the vesrions are the same.


HTH
B\rgds
100
 
Back
Top