fix disposal and add tests

This commit is contained in:
Adam Hathcock
2026-01-23 10:25:41 +00:00
parent fbc168fafe
commit 060b1ed5dd
3 changed files with 557 additions and 14 deletions

View File

@@ -158,18 +158,18 @@ public partial class SharpCompressStream
{
return;
}
_isDisposed = true;
if (LeaveOpen)
{
return;
}
if (ThrowOnDispose)
{
throw new InvalidOperationException(
$"Attempt to dispose of a {nameof(SharpCompressStream)} when {nameof(ThrowOnDispose)} is {ThrowOnDispose}"
);
}
_isDisposed = true;
await base.DisposeAsync();
if (this.LeaveOpen)
{
return;
}
await Stream.DisposeAsync();
if (_buffer != null)
{