我正在尝试创建一个序列化和反序列化数据文件的方法,但我遇到了一些错误。
System.InvalidOperationException:XML文档中存在错误(10,10)。
有没有办法获取数据文件的内容以查看它可能是什么?
#if WINDOWS_PHONE
IsolatedStorageFile dataFile = IsolatedStorageFile.GetUserStoreForApplication();
#else
IsolatedStorageFile dataFile = IsolatedStorageFile.GetUserStoreForDomain();
#endif
try
{
// Create an isolated storage stream and initialize it as null.
IsolatedStorageFileStream isolatedFileStream = null;
// Open the isolated storage stream, and write the save data file.
if (dataFile.FileExists(filename))
{
using (isolatedFileStream = dataFile.OpenFile(filename, FileMode.Open, FileAccess.ReadWrite))
{
// Read the data from the file.
XmlSerializer serializer = new XmlSerializer(typeof(Data));
// Store each of the deserialized data objects in the list.
Data savedData = (Data)serializer.Deserialize(isolatedFileStream);