Напомню:
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Assembly : IEvidenceFactory, ICustomAttributeProvider, ISerializable
Вот код сериалазации:
Assembly a = Assembly.LoadFrom("C:\SomeAssembly.dll");
BinaryFormatter formatter = new BinaryFormatter();
FileStream stream = new FileStream("assembly.dat", FileMode.Create);
formatter.Serialize(stream, a);
stream.Close();
Далее пытаемся десериализовать все это:
BinaryFormatter formatter = new BinaryFormatter();
FileStream stream = new FileStream("assembly.dat", FileMode.Open);
Assembly a = (Assembly)formatter.Deserialize(stream);
При десериализации происходит исключение:
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
Additional information: Insufficient state to deserialize the object. More information is needed.