So I've found a bunch of threads on this topic but I don't think I've found one that applies yet.
Basically my .exe loads a .dll (MyAssembly) file which does the serialization and loading. Obviously it serializes quite fine.
But when I go to deserialize the file within the MyAssembly.dll file it explodes with the error in the title of this post.
Anyone have any ideas? I don't understand how it can't find the assembly that is calling the code!
My code:
// deserialize
using (var target = new System.IO.FileStream(Path, System.IO.FileMode.OpenOrCreate))
{
var bin = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
var Obj = bin.Deserialize(target);
if (Obj != null)
{
ObjectToStore = (ObjectTypeInMyAssembly)Obj;
}
}
// serialize
using (var target = new System.IO.FileStream(Path, System.IO.FileMode.OpenOrCreate))
{
var bin = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
bin.Serialize(target, ObjectToStore);
}