NotSupportedException for forward-only reading of unseekable ConnectStream
AlexVallat opened this issue · 5 comments
AlexVallat commented
When using ZipReader over the ConnectStream obtained from a HttpWebResponse, it fails at the second call of MoveToNextEntry due to attempting to access the .Position of the underlying stream. ConnectStream does not support .Position as it does not support seeking.
adamhathcock commented
Can you give me the full stack trace? It definitely shouldn't be doing that.
adamhathcock commented
Never mind, I reproduced it.
AlexVallat commented
Just in case, I might as well post the stack anyway now that I've captured it:
System.NotSupportedException: This stream does not support seek operations.
at System.Net.ConnectStream.get_Position()
at SharpCompress.IO.NonDisposingStream.get_Position() in d:\dev\SharpCompress\src\SharpCompress\IO\NonDisposingStream.cs:line 46
at SharpCompress.IO.RewindableStream.get_Position() in d:\dev\SharpCompress\src\SharpCompress\IO\RewindableStream.cs:line 97
at SharpCompress.Common.Zip.StreamingZipHeaderFactory.<ReadStreamHeader>d__0.MoveNext() in d:\dev\SharpCompress\src\SharpCompress\Common\Zip\StreamingZipHeaderFactory.cs:line 34
at SharpCompress.Reader.Zip.ZipReader.<GetEntries>d__0.MoveNext() in d:\dev\SharpCompress\src\SharpCompress\Reader\Zip\ZipReader.cs:line 46
at SharpCompress.Reader.AbstractReader`2.NextEntryForCurrentStream() in d:\dev\SharpCompress\src\SharpCompress\Reader\AbstractReader.cs:line 137
at SharpCompress.Reader.AbstractReader`2.MoveToNextEntry() in d:\dev\SharpCompress\src\SharpCompress\Reader\AbstractReader.cs:line 102
AlexVallat commented
Thanks for the quick response!