Skip to content

Commit

Permalink
Do not dispose streams if not asked
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Dec 28, 2024
1 parent 5fa4f6b commit 781ad68
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/DotNext.IO/IO/SparseStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,12 @@ protected override void Dispose(bool disposing)

public override async ValueTask DisposeAsync()
{
for (var i = 0; i < Streams.Length; i++)
if (!leaveOpen)
{
await Streams[i].DisposeAsync().ConfigureAwait(false);
for (var i = 0; i < Streams.Length; i++)
{
await Streams[i].DisposeAsync().ConfigureAwait(false);
}
}

GC.SuppressFinalize(this);
Expand Down

0 comments on commit 781ad68

Please sign in to comment.