[
  {
    "Id": "216978",
    "ThreadId": "63811",
    "Html": "<p>I am getting the following error when I run this code:</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>\t\t<span style=\"color:Blue\">public</span> Stream GetChangesStr(Stream reqSyncGetChanges)\r\n\t\t{\r\n\t\t\t<span style=\"color:Blue\">try</span>\r\n\t\t\t{\r\n\t\t\t\tDebug.Print(DateTime.Now + <span style=\"color:#A31515\">&quot; Server GetChangesStr Start.&quot;</span>);\r\n\r\n\t\t\t\tDataContractSerializer dcsReq = <span style=\"color:Blue\">new</span> DataContractSerializer(<span style=\"color:Blue\">typeof</span>(ReqSyncGetChanges));\r\n\t\t\t\tReqSyncGetChanges req = <span style=\"color:Blue\">null</span>;\r\n\t\t\t\t<span style=\"color:Blue\">using</span> (Ionic.Zlib.ZlibStream deflateStream = <span style=\"color:Blue\">new</span> Ionic.Zlib.ZlibStream(reqSyncGetChanges, Ionic.Zlib.CompressionMode.Decompress))\r\n\t\t\t\t{\r\n\t\t\t\t\treq = (ReqSyncGetChanges)dcsReq.ReadObject(deflateStream);\r\n\t\t\t\t}\r\n\r\n</pre>\r\n</div>\r\n<p>The last line creates the error below.&nbsp; How do I avoid this?</p>\r\n<p>Ionic.Zlib.ZlibException occurred<br>&nbsp; Message=&quot;inflating: &quot;<br>&nbsp; Source=&quot;Ionic.Zip&quot;<br>&nbsp; StackTrace:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Ionic.Zlib.ZlibBaseStream.Read(Byte[] buffer, Int32 offset, Int32 count)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Ionic.Zlib.ZlibStream.Read(Byte[] buffer, Int32 offset, Int32 count)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.IO.BufferedStream.ReadByte()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Xml.EncodingStreamWrapper.ReadBOMEncoding(Boolean notOutOfBand)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Xml.EncodingStreamWrapper..ctor(Stream stream, Encoding encoding)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Xml.XmlUTF8TextReader.SetInput(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Xml.XmlDictionaryReader.CreateTextReader(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(Stream stream)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Protiviti.Construct.DataSyncService.ProtivitiConstructLocalDataCacheSyncService.GetChangesStr(Stream reqSyncGetChanges) in D:\\Projects\\SolutionsPortal\\Trunk\\Protiviti.Construct\\Desktop\\Protiviti.Construct.DataSyncService\\ProtivitiConstructLocalDataCache.Server.SyncContract.cs:line 98<br>&nbsp; InnerException:</p>",
    "PostedDate": "2009-07-28T15:21:51.67-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "216981",
    "ThreadId": "63811",
    "Html": "<p>Got the latest version and have a slightly better error:</p>\r\n<p>System.Xml.XmlException occurred<br>&nbsp; Message=&quot;Unexpected end of file.&quot;<br>&nbsp; Source=&quot;System.Runtime.Serialization&quot;<br>&nbsp; LineNumber=0<br>&nbsp; LinePosition=0<br>&nbsp; StackTrace:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Xml.EncodingStreamWrapper.ReadBOMEncoding(Boolean notOutOfBand)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Xml.EncodingStreamWrapper..ctor(Stream stream, Encoding encoding)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Xml.XmlUTF8TextReader.SetInput(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Xml.XmlDictionaryReader.CreateTextReader(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(Stream stream)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Protiviti.Construct.DataSyncService.ProtivitiConstructLocalDataCacheSyncService.GetChangesStr(Stream reqSyncGetChanges) in D:\\Projects\\SolutionsPortal\\Trunk\\Protiviti.Construct\\Desktop\\Protiviti.Construct.DataSyncService\\ProtivitiConstructLocalDataCache.Server.SyncContract.cs:line 98<br>&nbsp; InnerException:</p>",
    "PostedDate": "2009-07-28T15:42:19.137-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "217025",
    "ThreadId": "63811",
    "Html": "<p>a better error!&nbsp; I like your attitude.</p>",
    "PostedDate": "2009-07-28T19:13:16.307-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "217034",
    "ThreadId": "63811",
    "Html": "<table border=0 width=800>\r\n<tbody>\r\n<tr>\r\n<td>\r\n<p>Mr Stewart,</p>\r\n<p>looking at the stacktrace, I can make several observations:</p>\r\n<ol>\r\n<li>There is no Ionic or ZLIB code on the stack. It looks like it is failing in code that is not part of DotNetZip. So I don't know if it's DotNetZip's problem. </li>\r\n<li>your code it appears to be failing as it tries to read a BOM.&nbsp; BOM = Byte Order Mark, a series of 2 or 3 super-ASCII characters which is often prepended to the beginning of unicode-encoded files.&nbsp; You might get this error, for example, if the Reader expects a BOM and there is none present.&nbsp; Could that be possible?</li>\r\n</ol>\r\n<p>If it were ME troubleshooting this, I would eliminate a few variables. For example, to eliminate the DotNetZip part:</p>\r\n<ol>\r\n<li>Does the error occur if the data is not decompressed as you are trying to read it in? In other words, if you read the data as it was in its <em>original format,</em> with no compression or decompression?</li>\r\n<li>if that works, then... re-introduce the compression, and verify that the decompressed data exactly matches the pre-compressed data.</li>\r\n<li>if you can verify the compress/decompress loop produces EXACTLY the same data, and the original data can be read successfully, then the decompressed data will also be read successfully. </li>\r\n</ol></td>\r\n</tr>\r\n</tbody>\r\n</table>",
    "PostedDate": "2009-07-28T19:24:31.3-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]