Skip to content

Deduplicate Tar sync/async tests #127379

Description

@rzikm

See parent issue #127376.

Ideally, introduce similar abstraction like used in ZipArchive tests, so that tests can be parameterized by a bool to test both sync and async code paths.

public static async Task<ZipArchive> CreateZipArchive(bool async, Stream stream, ZipArchiveMode mode, bool leaveOpen = false, Encoding entryNameEncoding = null)
{
return async ?
await ZipArchive.CreateAsync(stream, mode, leaveOpen, entryNameEncoding) :
new ZipArchive(stream, mode, leaveOpen, entryNameEncoding);
}
public static async Task DisposeZipArchive(bool async, ZipArchive archive)
{
if (async)
{
await archive.DisposeAsync();
}
else
{
archive.Dispose();
}
}
public static async Task<Stream> OpenEntryStream(bool async, ZipArchiveEntry entry)
{
return async ? await entry.OpenAsync() : entry.Open();
}

Activity

  1. dotnet-policy-service commented on Apr 24, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-formats-tar
    See info in area-owners.md if you want to be subscribed.

  2. removed
    untriagedNew issue has not been triaged by the area owner
    on May 12, 2026
  3. added this to the Future milestone on Jun 8, 2026
  4. added theissue type on Jun 8, 2026
  5. added a commit that references this issue on Sep 30, 2026
    6fe5c26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions