同一个dll,用Assembly.LoadFrom可以正确读取使用,但用AppDomain.Load方法却不能读取,错误提示为:反序列化信息不足,需要详细信息。 在这个Dll的类中,我按照MSDN的帮助文件为类作了序列化标记。 [Serializable] public class Const { ...... } 期待能尽快得到解答。
AppDomain.Load() is only meant to be called on AppDomain.CurrentDomain. (It's meant for interop callers only. They need a non-static method, and Assembly.Load() is static.) If you call it on a different AppDomain, if the assembly successfully loads in the target appdomain, remoting will then try to load it in the calling appdomain, potentially causing a FileNotFoundException/SerializationException for you.