开发者

getting "unable to find assembly" when trying to deserialize, works from client to server but not the other way

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?


Look at the AppDomain.AssemblyResolve event.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜