You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Accept non-seekable streams in ReqIFDeserializer and ReqIFLoaderService
#91
I have verified that I am running the latest version of the reqifsharp
I have searched open and closed issues to ensure it has not already been reported
Description
ReqIFDeserializer.Deserialize(Stream, ...) and DeserializeAsync read stream.Length in their argument check and then call stream.Seek(0, SeekOrigin.Begin); ReqIFLoaderService.LoadAsync also seeks on the stream it receives. Non-seekable streams support neither. Network streams, HTTP response streams and browser upload streams are not seekable, so callers have to copy them into a MemoryStream first. This is documented in the wiki now, but it is easy to miss.
Proposal
When stream.CanSeek is false, buffer the stream internally (or read it once without seeking) instead of failing; when it is seekable, keep the current behaviour.
Acceptance criteria
Deserializing from a non-seekable wrapper around a .reqif and a .reqifz file gives the same result as from a FileStream, for the sync and async methods and for ReqIFLoaderService.LoadAsync.
Steps to Reproduce
Pass a stream with CanSeek == false (for example an HTTP response stream, or a GZipStream in decompress mode around a compressed .reqif) to Deserialize: it throws NotSupportedException from the argument check (StreamBasedSerializerArgumentValidation, which reads stream.Length).
Activity