title: How to analyse contents of binary serialization stream?
body: <p>I'm using binary serialization (BinaryFormatter) as a temporary mechanism to store state information in a file for a relatively complex (game) object structure; the files are coming out <strong>much</strong> larger than I expect, and my data structure includes recursive references - so I'm wondering whether the BinaryFormatter is actually storing multiple copies of the same objects, or whether my basic "number of objects and values I should have" arithmentic is way off-base, or where else the excessive size is coming from.</p>
  
  <p>Searching on stack overflow I was able to find the specification for Microsoft's binary remoting format:
  <a href="http://msdn.microsoft.com/en-us/library/cc236844(PROT.10).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/cc236844(PROT.10).aspx</a></p>
  
  <p>What I can't find is any existing viewer that enables you to "peek" into the contents of a binaryformatter output file - get object counts and total bytes for different object types in the file, etc; </p>
  
  <p>I feel like this must be my "google-fu" failing me (what little I have) - can anyone help? This <em>must</em> have been done before, right?? </p>
  
  <hr>
  
  <p><strong>UPDATE</strong>: I could not find it and got no answers so I put something relatively quick together (link to downloadable project below); I can confirm the BinaryFormatter does not store multiple copies of the same object but it does print quite a lot of metadata to the stream. If you need efficient storage, build your own custom serialization methods.</p>