我有一个程序可以序列化和反序列化调用,当我尝试将 DLL 附加到另一个程序时,它会显示:Unable to find assembly 'ASCOM.BHOProxy.Connector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=74643865492aa2e6'.
我可以理解这是一个引用问题还是什么问题,但问题是抛出异常的代码是in 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