Connecting Tech Pros Worldwide Forums | Help | Site Map

Serialisation fails, but without any errors being thrown.

Greg
Guest
 
Posts: n/a
#1: Sep 7 '06
I have a bizarre situation in which serialisation is failing routinely
under a specific condition, and I'm wondering if the details ring a
bell with anyone here.

I have 2 classes that my application serialises before closing down.
One of these classes contains a string field which contains a path to a
file. This is populated from the contents of a text box, which in turn
is populated using an OpenFileFialog object.

Under normal usage, the 2 classes always fail to be serialised.
However, if a path is manually typed into the text box mentioned above,
serialisation works. At the point of serialisation, I've checked that
the field corresponding to the file path is the same, regardless of how
the path was entered into the text box (typed or using an
OpenFileDialog object).

This is absolute madness - why should the fact that an OpenFileDialog
box has been used at some point in the application's lifetime mean
that serialisation fails?

Stepping through the serialisation (done using the BinaryFormatter), I
can't see any obvious problems and certainly no errors are being
thrown.

I'm confident that the OpenFileDialog object is relevant to the
problem as whether it is used or not is the sole user action that
defines whether serialisation works or not.

For what its worth, I use different BinaryFormatter objects for
serialising the two classes (they are local to the method they are
used in).

Please spare me from insanity!

Greg


Stoitcho Goutsev \(100\)
Guest
 
Posts: n/a
#2: Sep 8 '06

re: Serialisation fails, but without any errors being thrown.


Greg,

Can you post simple compilable sample the demonstrates the problem and we
can fiddle with.


--
Stoitcho Goutsev (100)

"Greg" <gregwilliams001@yahoo.co.ukwrote in message
news:1157637276.488316.265020@d34g2000cwd.googlegr oups.com...
Quote:
>I have a bizarre situation in which serialisation is failing routinely
under a specific condition, and I'm wondering if the details ring a
bell with anyone here.
>
I have 2 classes that my application serialises before closing down.
One of these classes contains a string field which contains a path to a
file. This is populated from the contents of a text box, which in turn
is populated using an OpenFileFialog object.
>
Under normal usage, the 2 classes always fail to be serialised.
However, if a path is manually typed into the text box mentioned above,
serialisation works. At the point of serialisation, I've checked that
the field corresponding to the file path is the same, regardless of how
the path was entered into the text box (typed or using an
OpenFileDialog object).
>
This is absolute madness - why should the fact that an OpenFileDialog
box has been used at some point in the application's lifetime mean
that serialisation fails?
>
Stepping through the serialisation (done using the BinaryFormatter), I
can't see any obvious problems and certainly no errors are being
thrown.
>
I'm confident that the OpenFileDialog object is relevant to the
problem as whether it is used or not is the sole user action that
defines whether serialisation works or not.
>
For what its worth, I use different BinaryFormatter objects for
serialising the two classes (they are local to the method they are
used in).
>
Please spare me from insanity!
>
Greg
>

Greg
Guest
 
Posts: n/a
#3: Sep 11 '06

re: Serialisation fails, but without any errors being thrown.


Stoitcho,

Thanks, I sorted it in the end. I was using a relative file path for
the serialisation, and the opening of the openfiledialog box was
changing the working file path.

Regards,

Greg.

Stoitcho Goutsev (100) wrote:
Quote:
Greg,
>
Can you post simple compilable sample the demonstrates the problem and we
can fiddle with.
>
>
--
Stoitcho Goutsev (100)
>
"Greg" <gregwilliams001@yahoo.co.ukwrote in message
news:1157637276.488316.265020@d34g2000cwd.googlegr oups.com...
Quote:
I have a bizarre situation in which serialisation is failing routinely
under a specific condition, and I'm wondering if the details ring a
bell with anyone here.

I have 2 classes that my application serialises before closing down.
One of these classes contains a string field which contains a path to a
file. This is populated from the contents of a text box, which in turn
is populated using an OpenFileFialog object.

Under normal usage, the 2 classes always fail to be serialised.
However, if a path is manually typed into the text box mentioned above,
serialisation works. At the point of serialisation, I've checked that
the field corresponding to the file path is the same, regardless of how
the path was entered into the text box (typed or using an
OpenFileDialog object).

This is absolute madness - why should the fact that an OpenFileDialog
box has been used at some point in the application's lifetime mean
that serialisation fails?

Stepping through the serialisation (done using the BinaryFormatter), I
can't see any obvious problems and certainly no errors are being
thrown.

I'm confident that the OpenFileDialog object is relevant to the
problem as whether it is used or not is the sole user action that
defines whether serialisation works or not.

For what its worth, I use different BinaryFormatter objects for
serialising the two classes (they are local to the method they are
used in).

Please spare me from insanity!

Greg
Closed Thread