Deserialization throws "no top object" exception

Feb 15 2005 3:13 AM
Hi... When I try to Deserialize a stream of data to an object, it throws an exception "no top object". Any help? Its not reproducible always. The code(relevant portion) goes like this: public virtual ObjectGraph DeSerialize(MemoryStream memoryStream) { BinaryFormatter formatter = new BinaryFormatter(); try { memoryStream.Seek(0, SeekOrigin.Begin); ObjectGraph objectGraph = (ObjectGraph) formatter.Deserialize(memoryStream); return objectGraph; } catch { throw; } Any help will b greatful.. Thx in advance.. Ganesh.