Preserve manifest input streams when writing manifests - #14883
Open
dtivel wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dtivel
temporarily deployed
to
copilot-pat-pool
August 28, 2026 23:38 — with
GitHub Actions
Inactive
dtivel
temporarily deployed
to
copilot-pat-pool
August 28, 2026 23:38 — with
GitHub Actions
Inactive
dtivel
had a problem deploying
to
copilot-pat-pool
August 28, 2026 23:39 — with
GitHub Actions
Failure
dtivel
temporarily deployed
to
copilot-pat-pool
August 28, 2026 23:44 — with
GitHub Actions
Inactive
dtivel
temporarily deployed
to
copilot-pat-pool
August 28, 2026 23:45 — with
GitHub Actions
Inactive
dtivel
temporarily deployed
to
copilot-pat-pool
August 28, 2026 23:45 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Tasks/ManifestUtil/Util.cs — WriteFile(string, Stream) now uses leaveOpen: true, so it no longer disposes the… |
What changed in this PR
This PR fixes a regression in the manifest utilities where writing a manifest could dispose the manifest’s preserved (caller-owned) input stream, breaking subsequent reuse of the same Manifest instance.
Changes:
- Update
Util.WriteFile(string, Stream)to construct aStreamReaderwithleaveOpen: trueso disposing the reader doesn’t close the supplied stream. - Add a regression unit test that writes the same manifest twice after rewinding its preserved input stream and verifies both outputs match and the input stream remains readable.
| File | Description |
|---|---|
| src/Tasks/ManifestUtil/Util.cs | Preserves caller-owned streams by leaving the input stream open when reading it via StreamReader. |
| src/Tasks.UnitTests/ManifestWriter_Tests.cs | Adds regression coverage to ensure ManifestWriter.WriteManifest doesn’t dispose preserved input streams and that repeated writes are consistent. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #14881.
Summary
Ensure
ManifestWriter.WriteManifestleaves the manifest's caller-owned input stream open after writing.PR #9983 began disposing the
StreamReader, which also disposed the underlying manifest input stream. This caused subsequent calls toManifestWriter.WriteManifestusing the same manifest to fail withStream was not readable.The explicit
StreamReaderarguments preserve the previous encoding, BOM detection, and buffer-size behavior while settingleaveOpen: true.Compatibility
This restores the stream-ownership behavior from before PR #9983. No ChangeWave is needed because this is a narrow regression fix and does not change the public API surface.
Tests
Added regression coverage that:
The regression test passes on both
net11.0andnet472.