How can I deserialize or repair a binary serialized dictionary that hasn't completed serialization?

When I used my app, take a closer look, it tried to serialize a 300KB dictionary. Due to the lack of disk space, it could only write 292KB. Is there a way to successfully deserialize whatever is there?

I have used BinaryFormatter and if I have lost some elements this way, it is better than losing my entire 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 ..."

      

+2


source to share


1 answer


Allocating binary streams does require a lot of implementation knowledge. BinaryFormatter

is proprietary, so ... if this data isn't really valuable, it might be cheaper to consider it lost. You can do a lot of scrobbling, but it won't be easy and the development time isn't cheap.



I am not saying that this cannot be done. FWIW, I can think of ways to do this for some other serializers - just not BinaryFormatter

.

+2


source







All Articles