我有一个序列化和反序列化调用的程序,当我尝试将我的 DLL 附加到另一个程序时,它说:Unable to find assembly 'ASCOM.BHOProxy.Connector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=74643865492aa2e6'.
我可以理解这是否是参考问题或其他问题,但问题是引发异常的代码位于 ASCOM.BHOProxy.Connector
. 我曾想过使用某种第三方序列化器,但我不太确定要使用什么。程序集由应用程序加载的另一个 DLL 加载。
序列化的数据通过 TCP 连接传输到相同的连接器(通常是由另一个程序加载的相同文件),并在此处进行反序列化。当它试图反序列化它时会抛出异常,但它只在从外部程序调用它时才会这样做。在 Visual Studio 中调试时效果很好。
Their Program --(late binding)--> My Main DLL --(.NET Project Reference)--> My Connector DLL
堆栈跟踪:
at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at Connector.PortComProxy.DecodeMessage(List`1 buff) in c:\Users\Arlen\Documents\Visual Studio 2012\Projects\DriverProxy\PortComClient\PortComProxy.cs:line 259