Could not find assembly

I am serializing an ArrayList for a binary to send it over TCP / IP. The serialized file is created by the server, and I hope that it can deserialize it with the client that I am writing at the moment.

However, when the client tries to deserialize this, it throws a SerializationException because it cannot find the assembly (presumably) with which the serialized file was started.

How do I get around this?

+3
arraylist c # serialization
source share
3 answers

Does your arraylist support a custom data type (i.e. your own classes)?

An arraialist will not be deserialized if the code performing the deserialization does not have access to all the classes contained in the arraylist.

+5
source share

If you use binary serialization, the client must have access to a DLL that contains the type that you serialize to ArrayList. I probably don’t know about your setup to describe how this should be done, but what is the essence of this.

If you use something like XML serialization (either using XmlSerializaer or DataContractSerializer), you can create Xml. You can duplicate object code on the server and client side if you really cannot share the assembly.

+1
source share

What is the data you are trying to send? And how do you serialize it? If you use BinaryFormatter , then the assembly declaring any custom types should be at both ends.

Please note that BinaryFormatter has a number of serialization problems on different systems (including between different versions of the same system). You can look at other serializers like DataContractSerializer or protobuf-net (for efficient cross-platform binary transfer).

0
source share

All Articles