Serialization of data for two or more executables

  • Thread starter Thread starter ven
  • Start date Start date
V

ven

I have used C# binary formatter to serialize and
deserialize a data structure. However, for the same data
format( used by the first executable, the same *.CS
files), the second executable gives an error referring to
the first assembly name missing, when trying to
deserialize the *.dat file. When I rename the second
executable to the first executable, it works fine. the
*.dat file was created by the first executable.

Could any one help me, what I am missing ?
Thanks in advance.
ven
 
Rephrasing my question, is there a way to deserialize
objects Serialized by another assembly/exe. I have two
different executables which use same *.dat file to
communicate.
Previously I had no problem in developing stage as i was
building them from the same project directory and
selecting manually different main entry points and
renaming the executables as different names.

As I have seperated in the Release version the two
executables as seperate project one cannot read the
other's *.dat file expecting the others assembly as
missing.
Is there a way to get around this problem ?

Thanks in advance. Any pointers would be appreciated ..
 
the "textbook" way do accomplish what you are asking is
(i believe) to deserialize using SerializationBinder, an
example of this is published in
msdn.microsoft.com/library/en-
us/cpref/html/frlrfsystemruntimeserializationserialization
binderclasstopic.asp

But your question brings up a different issue: is there
a way to surpress assemly information in the
serialization produced by BinaryFormatter? the docs
suggest that BinaryFormatter is suitable for objects
shared by multiple apps, for instance on the clipboard--
but if this is the case the clipboard object shouldn't be
tied to any particular assembly (should it?). similarly,
it seems like serialization using BinaryFormatter would
produce a reasonable candidate for an application
independent file format (say ".mySpiffyJpeg"), but you
probably wouldnt want a file format like this tied to a
specific assembly.

does anyone have comments on whether BinaryFormatter was
designed to be used for assembly-independent purposes
such as clipboard or file formats?
 
Back
Top