开发者

How to deserialize or recover a binary serialized dictionary that's not finished serializing?

When I used my app, on close, it tried to serialize a dictionary that's 300 KB. Because of no disk space, it could only write 292 KB. Is there a way to successfully deserialize whatever is in there?

I used BinaryFormatter and if I lose some elements that's way better than losing the whole dictionary.

When I deserialize I get this exception:

    e.Message   "The input stream is not a开发者_开发百科 valid binary format. The starting contents (in bytes) are: 20-01-20-20-20-FF-FF-FF-FF-01-20-20-20-20-20-20-20 ..."


Picking apart binary streams really needs a lot of knowledge about the implementation. BinaryFormatter is proprietary, so... unless that data is really valuable, it might be cheaper to consider it lost. You could do a lot of scrobbling, but it won't be easy, and dev time isn't cheap.

I'm not saying it can't be done, though. FWIW, I can think of ways of doing this for some other serializers - just not BinaryFormatter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜