I'm using this to serialize a map of objects to a binary file:
In general, it works fine. The file is then deserialized with this, similar, code:Code:Dim bf As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter Using fs As New System.IO.FileStream(mSaveFileName, IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write) bf.Serialize(fs, someObject) End Using
The issue I'm having is that every now and then, unpredictably, reading a file will fail with an error about a string not being in the right format. This is rare enough that I have seen it happen only twice in a few dozen tries. It's mighty annoying when it does happen, though, because binary serialized files are essentially useless if they can't be deserialized.Code:Dim bf As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter Using fs As New System.IO.FileStream(flnm, IO.FileMode.Open) mGPool = CType(bf.Deserialize(fs), someObject) End Using
The code is REALLY old, so am I missing something?






Reply With Quote