public void DeSerialize() { BinaryFormatter formatter = new BinaryFormatter(); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(OnResolveAssembly); formatter.Deserialize(stream); AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(OnResolveAssembly); } private Assembly OnResolveAssembly(object sender, ResolveEventArgs args) { Assembly assembly = System.Reflection.Assembly.Load(args.Name); if (assembly != null) { return assembly; } return Assembly.GetExecutingAssembly(); }