CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: XML error

  1. #1
    Join Date
    Aug 2011
    Posts
    0

    XML error

    Need help here. Trying to use serialization to save my array of monsters but got this error.


    An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll

    Additional information: There was an error generating the XML document.


    Here's my code:

    public void Save()
    {
    using (IsolatedStorageFile saveGameFile = IsolatedStorageFile.GetUserStoreForApplication())
    using (IsolatedStorageFileStream SaveGameStream = new IsolatedStorageFileStream("monster.dat", FileMode.OpenOrCreate, saveGameFile))
    {
    XmlSerializer serializer = new XmlSerializer(typeof(List<Monster>));
    serializer.Serialize(SaveGameStream, _lMonster); <------ error on this line
    }
    }

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: XML error

    Is _IMonster the same type as typeof(List<Monster>)?

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

Featured