microknights / SplitStream

Split stream into multiple streams that can be read concurrently

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exceptions from Dispose()

matyasbach opened this issue · comments

Thank you for this repository.

Why are exceptions thrown from Dispose() methods? I believe it should not check anything but just release everything.

  1. IMO it should be up to client code if it reads every stream to the end
  2. In case of calling Dispose because of exception - this exception gets lost

(My use-case is reading huge file from network stream and in 1st stream saving it to the file system, 2nd stream just analyzes some headers - no need to read stream to the end. No parrallel stuff, just async/await - works well if I read both streams to the end. So 1) led me here, 2) is the real blocker for using it :/ )

okay, i think i understand your issue. I will have a look on what options we have to support your feature request.

@microknights thank you. If I can help somewhow, let me know please.

Correct, exception in dispose is the wrong path.

I have made it configurable through SplitStreamOptions where it, by default, do not throws any exceptions in dispose - when doing the sanity check.

Check out the prerelease 1.1.0-beta1 nuget, and give status.

Thank you, it works fine 👍 A thanks also for such a quick replies and solution.
Unfortunatelly I forgot that chunks not yet read by all output streams are buffered in memory. So I'll still have to read both streams to the end.