internal static object UnmarshalFromBuffer(byte[] b, bool crossRuntime) { MemoryStream serializationStream = new MemoryStream(b); object proxy = new BinaryFormatter { AssemblyFormat = FormatterAssemblyStyle.Simple, SurrogateSelector = null, Context = new StreamingContext(StreamingContextStates.Other) }.Deserialize(serializationStream, null, false); if (crossRuntime && IsTransparentProxy(proxy)) { if (!(GetRealProxy(proxy) is RemotingProxy)) { return proxy; } if (ChannelServices.RegisteredChannels.Length == 0) { return null; } proxy.GetHashCode(); } return proxy; }