views:

33

answers:

2

Hello, I've read plenty of similar questions and answers on this topic, but still not sure why I get this problem.

I have a client and server projects, both using the same dll library I created. when I serialize an object on the client, I have no problem deserializing it on the server, however when I try to deserialize it on the client after the server serialized it, it throws an "Unable to find assembly" exception.

the code of serializing and deserializing is identical on both client and server, both of them know and work with the same dll, any ideas what could cause the problem?

+1  A: 

Look at the AppDomain.AssemblyResolve event.

leppie
Awesome! that solved the problem, thanks a lot :)
Nadav
Solved by implementing the AssemblyResolve event according to the example on msdn.
Nadav
A: 

Does anything else perhaps creep into the model? A classic example is events; BinaryFormatter includes event graphs, which causes all kinds of unexpected things to be included. If you have events, mark the backing field as [NonSerialized], or for field- like events:

[field: NonSerialized]
public event SomeType Foo;

Or better, use a serializer that doesnt include event graphs.

Marc Gravell
there are no events in my custom object, problem solved anyhow, but thx :)
Nadav