Agents In Use
What’s new todayLast update
108 use cases added today

How to use GitHub Copilot to test TarReader disposal

Copilot investigated TarReader disposal, found the runtime fix already present and added synchronous and asynchronous regression tests before the PR merged.

FROM THE SOURCE

Original prompt

Shared by the source author. See source notes for context.

Disposing TarEntry.DataStream causes TarReader.GetNextEntry to throw ObjectDisposedException

Evidence at a glance

Sourced account
Original account
Read the source ↗
Published
Source link checked
Reported result
Copilot investigated TarReader disposal, found the runtime fix already present and added synchronous and asynchronous regression tests before the PR merged; the pull request merged into dotnet/runtime main.
Human involvement
Human scoped task and reviewed/merged.

A linked account supports attribution. It does not mean we independently reproduced its result.

Report an issue with this caseOpen correction email

Opens your email app with the case link included. Nothing is sent automatically.

How the agent did it

  1. Investigated disposal bug and found production fix already present.
  2. Added full/partial/no-read cases for synchronous and asynchronous GetNextEntry.
  3. Ran Tar test suite.

A TarReader report described an ObjectDisposedException when a caller disposed an entry's DataStream before advancing through an unseekable archive. Stephen Toub delegated the issue to GitHub Copilot, which investigated the current code rather than assuming a production change was still required.

The agent found that the underlying bug had already been fixed. SubReadStream.AdvanceToEnd now used internal fields instead of properties that throw after disposal. The useful remaining work was regression coverage to keep that behavior from being lost later.

Copilot added cases for a disposed stream after a full read, after a partial read and without reading any data. It covered both synchronous GetNextEntry and the asynchronous variant. The PR reports the archive library's test results, including skipped cases requiring privileges, and classifies the patch as test-only.

Maintainer review led to a merge on January 14, 2026. The outcome should be described as added coverage for an existing fix, not as Copilot repairing the runtime defect in this PR.

Prompt
Original prompt

Source: GitHub · Copilot (on behalf of stephentoub)

Frequently asked questions

Did this PR fix the production bug?

No. Copilot found the runtime correction already present and added regression tests to preserve the corrected behavior.

Which disposal cases were covered?

The tests dispose DataStream after a full read, a partial read or no read before advancing to the next archive entry.

Was asynchronous behavior covered too?

Yes. The PR adds corresponding cases for GetNextEntryAsync alongside synchronous GetNextEntry coverage.

More details

About this account

GitHub Copilot investigated or implemented the scoped repository task and produced a pull request, with work and checks recorded for maintainer review.

Primary pull request and public API timeline opened and checked on 2026-10-14. PR creation date is the original publication date; merge dates are separate result evidence. No new runtime fix: correct story is coverage for already-fixed behavior. Outcomes and test claims are attributed to the source and were not independently reproduced. Original prompt excerpt: reproduced verbatim from the public PR prompt; the full task contains additional context.

Credit: Copilot (on behalf of stephentoub) on GitHub

Source published

Added to Agents In Use

Source checked

Tools and topics

GitHub Copilot · TarReader · System.Formats.Tar · GitHub

Regression coverage · Archive streams · Test-only change

Editorial completeness: 100/100. Measures documented fields, not agent performance or verified outcomes.