Re: BinaryWriter/BinaryReader

On Feb 2, 2004, at 7:26 PM, Rob Hackett wrote:
...
I would like to be able to write this field to a local file to allow it to be archived seperately from ADDE database, along with any changes that a user may have made to the field. I have chosen to do this using BinaryWriter
and reading the field back using BinaryReader, as they seem to offer a
simple, efficient means to do this.
...
Initially this gets me exactly what I want, the field is written to file, and when read back in is exactly as it was before. The problem is I can only
read it once. If I attempt to read the file again (or any other file
containing this field structure) I get the following stack trace:
...
I can't reproduce this error using a more simple gridded FlatField, and the
error also occurs if I have previously used a field of this form when
extracted directly from AddePointDataReader, without having made any
previous reference to BinaryWriter or BinaryReader. It seems to be specific
to the data field structure that I'm trying to store.

        Could anyone explain to me what might be happening? Or alternatively
suggest another, equally simple way of storing a field of this structure to
a local file.

I'd bet you've found a bug in the BinaryReader code. If you can send me the file which causes the error, I'll try to fix the bug.