[PR #1139] [CLOSED] Fix BinaryReader disposal in TarArchive.IsTarFileAsync #1574

Open
opened 2026-01-29 22:21:12 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/1139
Author: @Copilot
Created: 1/16/2026
Status: Closed

Base: adam/async-creationHead: copilot/sub-pr-1132-again


📝 Commits (1)

📄 Description

The IsTarFileAsync method creates a BinaryReader on line 177 but doesn't dispose it, causing a resource leak.

Changes:

  • Wrap BinaryReader in a using statement in TarArchive.IsTarFileAsync to ensure proper disposal
  • Mirror the disposal pattern already used in the synchronous IsTarFile method on line 157
// Before
var reader = new BinaryReader(stream);
var readSucceeded = tarHeader.Read(reader);

// After  
using var reader = new BinaryReader(stream);
var readSucceeded = tarHeader.Read(reader);

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/1139 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 1/16/2026 **Status:** ❌ Closed **Base:** `adam/async-creation` ← **Head:** `copilot/sub-pr-1132-again` --- ### 📝 Commits (1) - [`a9664d8`](https://github.com/adamhathcock/sharpcompress/commit/a9664d8986a476e58b9bc6e2f368133ef335f31d) Initial plan ### 📄 Description The `IsTarFileAsync` method creates a `BinaryReader` on line 177 but doesn't dispose it, causing a resource leak. **Changes:** - Wrap `BinaryReader` in a `using` statement in `TarArchive.IsTarFileAsync` to ensure proper disposal - Mirror the disposal pattern already used in the synchronous `IsTarFile` method on line 157 ```csharp // Before var reader = new BinaryReader(stream); var readSucceeded = tarHeader.Read(reader); // After using var reader = new BinaryReader(stream); var readSucceeded = tarHeader.Read(reader); ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:21:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1574