Deserializing an object against a different verson of an assembly

Hi,

I'm using Couchbase .Net Connector 1.3.6 and trying to deserialize an object that was serialized against version 1.0.0 of a dll, with a version 2.0.0 of the dll, but getting a deserialization error (Stack trace at the bottom)

The error appears to be happening in the Enyim.dll

I know I could change the source code to use the type passed into the get method in with the Binder Property of the formatter.

I was just wondering if anyone had come across a similar problem, or if there was a better solution than hack el source code.

Cheers

James

Stack Trace:

System.Runtime.Serialization.SerializationException: Unable to find assembly 'MyAssembly.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

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.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 Enyim.Caching.Memcached.DefaultTranscoder.DeserializeObject(ArraySegment`1 value)

at Enyim.Caching.Memcached.DefaultTranscoder.Deserialize(CacheItem item)

at Enyim.Caching.Memcached.DefaultTranscoder.Enyim.Caching.Memcached.ITranscoder.Deserialize(CacheItem item)

at Couchbase.CouchbaseClient.PerformTryGet(String key, UInt64& cas, Object& value)

at Enyim.Caching.MemcachedClient.ExecuteTryGet(String key, Object& value)

at Enyim.Caching.MemcachedClient.ExecuteGet[T](String key)

at Bango.Couchbase.CouchbaseClientManager.ExecuteGet[T](String key) in c:\Development\Bango.Couchbase.root\Bango.Couchbase\CouchbaseClientManager.cs:line 213

at CBImporter.Form1.btnCompare_Click(Object sender, EventArgs e) in c:\Dev\CBCompare\Form1.cs:line 34

This is your problem here: System.Runtime.Serialization.SerializationException: Unable to find assembly 'MyAssembly.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Make sure MyAssembly.dll is referenced and in your /bin directory.

-Jeff

0 Answers

No answers yet