[Mono-dev] Problem with BinarySerialization
robertj at gmx.net
Tue Feb 2 07:52:25 EST 2010
On 02.02.2010 13:04, PFJ wrote:
> However, the problem comes when I try to read it back in into a different
> program. The read in code looks like this
> namespace molarity
> public class xmlhandler : Form, ISerializable
> System.Runtime.Serialization.SerializationException: Unable to find assembly
> 'elements, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null'.
> Do I need to add this into the references? I would have thought as it is an
> external file, it would just be read in via the stream method.
> Any ideas?
The serialization infrastructure heavily relies on type/assembly
identity, but what you're doing here is trying to create an object
from serialization data generated from a totally different class.
You should implement "Elements" in a separated assembly which you
reference from both apps. Then, in you "Form", you should aggregate
Elements, i.e. make it a field, because de/serializing a Form
is not what you want. Really.
public class xmlhandler : Form
public xmlhandler ()
theElements = deserialize them ...
More information about the Mono-devel-list