This project has moved and is read-only. For the latest updates, please go here.

PersistentDictionary constructor throws FileLoadException when called from new version of dll

Oct 18, 2013 at 10:40 AM
I have a dll that calls the PersistentDictionary constructor as
_dictionary = new PersistentDictionary<string, FSOStruct>(DBFile.DirectoryName);
But whenever I release a new version of my dll, so that it gets a new revision number, the constructor fails with a FileLoadException:
File name: 'Mydll.Model, Version=0.9.499.5038, Culture=neutral, PublicKeyToken=99ce60b096abdf27'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
   at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)
   at System.Runtime.Serialization.ObjectManager.DoFixups()
   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 Microsoft.Isam.Esent.Interop.Api.DeserializeObjectFromColumn(JET_SESID sesid, JET_TABLEID tableid, JET_COLUMNID columnid, RetrieveColumnGrbit grbit)
   at Microsoft.Isam.Esent.Interop.Api.DeserializeObjectFromColumn(JET_SESID sesid, JET_TABLEID tableid, JET_COLUMNID columnid)
   at Microsoft.Isam.Esent.Collections.Generic.PersistentDictionary`2.CheckDatabaseMetaData(String database)
   at Microsoft.Isam.Esent.Collections.Generic.PersistentDictionary`2..ctor(String directory)
Why is this, and what can I do to prevent it?

Regards,
Øyvind
Nov 15, 2013 at 7:58 PM
Tracking down Load failures can be annoying! Either use the Fusion Log Viewer (fuslogvw.exe; do a web search for it), or debug using your favourite debugger (I like cdb/windbg).
The failure might be due to signing, or versioning, or something else.

Good luck!

-martin