I dynamicaly load a dll, create a new object and serialize this object into byte array. It works fine. However I cannot deserialize this object because it throws an exception SerializationException: Unable to find assembly 'TicTacToe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Here is short code expamle
var loadedGame = Assembly.LoadFrom(pathdll);
var instances = from t in loadedGame.GetTypes()
where t.GetInterfaces().Contains(typeof(IMove))
select Activator.CreateInstance(t, 15) as IMove;
IMove move = instances.First();
var formatter = new BinaryFormatter();
using (MemoryStream stream = new MemoryStream())
{
formatter.Serialize(stream, move);
stream.Position = 0;
formatter.Deserialize(stream); // exception is thrown here
}
Do you have any idea how to deserialized object?
UPDATE:
Solution: How to serialize/deserialize an object loaded from another assembly?
Thanks you weston!