I wonder if this is a bug. I am serializing a class into XML using the following serializer code:
public static string SerializeObject<T>(Encoding encoding, T obj)
MemoryStream memoryStream = new MemoryStream();
using (XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, encoding))
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
return ByteArrayToString(encoding, memoryStream.ToArray());
I am currently using the 1.7 version of DotNetZip, and using the zip save code listed above (initial post), i am serializing the class and saving it as an xml file within the zip. I can extract the zip after its saved, and the xml file can be opened easily
with IE and the data displayed.
I then downloaded the latest version 1.8, and modified the zip code to zip.AddEntry (cause it was complaining that AddFileFromString is obsolete) and when i serialize the same class and save it, I cant seem to open the xml file in IE. When I edit the xml
file, it looks like there is an extra leading '?' that is causing this.
I tried saving some text via string into a text file, and then zipping it, but i dont have the same problem. I know the xmlserializing code works fine because i didnt have this problem with the 1.7 version.
Could this be a bug in the 1.8 version?