Results 1 to 4 of 4

Thread: .serialization not writing version info correctly

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2011
    Posts
    117

    .serialization not writing version info correctly

    Hi, I have a program that serializes a streamwriter like this:

    Dim objStreamWriter As New StreamWriter("file.temp")
    Dim x As New XmlSerializer(acct.items.GetType)
    x.Serialize(objStreamWriter, acct.items)
    objStreamWriter.Close()

    I then have a function that can load that file and deserialize it. It all works great to save and load files.

    I am now writing another program and need the same functionality, so I decided to copy and paste the code. It will not serialize correctly. It says that it has, but when I try to load it back in, it gives an error:

    There is an error in XML document (1,7).

    I tracked it down to this first line in the file:

    <?xml /eroion="1.0" encoding="utf-8"?>

    Obviously it needs to say version. The software does this automatically as far as I know.

    What is going on, and how can I fix this?

    Thanks!

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,369

    Re: .serialization not writing version info correctly

    Just a guess, but if you're copy-pasting code from another project, perhaps you need to check your project level imports and settings?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2011
    Posts
    117

    Re: .serialization not writing version info correctly

    I did. Everything is pretty basic. It seems as though there is a typo in whatever file it pulls the "version=" from. Do you know what file that is?

  4. #4
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,369

    Re: .serialization not writing version info correctly

    No, I am afraid not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width