Tips and tools for finding out why serialized files are so big
[VS.NET 2005 Beta 2]
Hi,
I was wondering if anyone knows of any tools that can help determine why (binary) serialized files are bigger than expected? Maybe something that graphs the serialized objects in the file?
If not, does anyone have any tips for finding out? I'm sure I can work it out with tracing but it would be good to hear if anyone knows any shortcuts!

Cheers,
G.
the algo is proprietary so no not really.
why do you think the serialized objects are larger than they should be? how are you serializing?
also, you can write custom serialization routines (look at GetObjectData methods)
Since we do not have access to the binary format, there is no easy way to detemine what data is in the file. It sure would be nice if we at least had a dump utility for the binary format so that we could peer inside the file (I'm not sure why Microsoft feels the need to keep the format so closely guarded). If you are lucky and only using the functionality provided by one of the human readable formats, you might be able to output your data in one of those formats and look at the contents but In my experience, there aren't two serialization models compatible enough to do so.
The only option I can think of other than tracing is to write your own formatter so that the data is readable and/or dumpable.
- Ray
Hmm, I was thinking something along the lines of a custom formatter, but wouldn't that work for any classes as long as the assemblies were available at the time?
That's why I thought I'd ask to see if there was a tool implementing such a formatter for diagnostic purposes :)
We use a mixture of custom and "built-in" serialization and the culprit is usually a missing [NonSerialzed] attribute. But they're a pain to find. A graph of what-references-what (like that tool that shows reachable objects whose name I forget) would be just the ticket.
Ah well... Thanks anyway! :(
That's a good question but glancing at the license agreement, I'd think a lawyer would have to answer that one.
I doubt anyone would sign this license just so they can peek inside the binary format to see what they serialized. At least I know I won't.
A converter from the binary format to human readable/xml would still be a nice tool to have.
- Ray