Repository navigation
[Microsoft.Android.Build.Tasks] Stream llvm-objdump output again - #13609
Merged
Merged
Conversation
Context: #12988 Context: #13515 #13515 switched RunObjdumpAsync to Process.RunAndCaptureTextAsync, which buffers stdout until llvm-objdump exits and breaks ObjdumpStreamsOutputBeforeProcessExit on macOS/Linux. Go back to ProcessUtils.StartProcess so output is streamed. Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change restoring streaming llvm-objdump output.
No open issues 🎉
What changed in this PR
Restores streaming of llvm-objdump output during NativeAOT type-map extraction, addressing the regression introduced by #13515.
Changes:
- Uses
ProcessUtils.StartProcessso stdout is consumed whilellvm-objdumpis running. - Captures stderr for nonzero-exit diagnostics; leaves
llvm-readobjprocessing unchanged.
| File | Description |
|---|---|
| src/Microsoft.Android.Build.Tasks/Tasks/ExtractTypeMapKeysFromNativeAotObject.cs | Restores streaming stdout and preserves error reporting for llvm-objdump. |
Review effort: Balanced
simonrozsival
enabled auto-merge (squash)
November 18, 2026 20:08
Member
Author
|
@dalexsoto review |
dalexsoto
approved these changes
Nov 18, 2026
dalexsoto
left a comment
Member
There was a problem hiding this comment.
Reviewed ecf131d8 against main at 1dc2fdd5 (merge-base 18b89409). This was a static, read-only review; I didn't build or run anything, so the macOS test results are from your description.
LGTM. What I checked:
- Revert scope: #13515 changed only the
RunObjdumpAsynchunk in this file, and this PR restores it line for line:ProcessUtils.StartProcess (startInfo, stdout, stderr, CancellationToken), theStringWriterfor stderr, and the sameInvalidOperationExceptionwith the exit code and stderr. Nothing else from #13515 needs restoring. - Streaming:
ProcessUtils.StartProcessreads stdout in chunks while the process runs and drains stderr concurrently, so a full stderr pipe can't stall llvm-objdump.TypeMapSymbolWriteroverridesWrite (char[], int, int)and keeps partial lines until the explicitFlush (), so chunks that split a line are handled. - Errors and cancellation: a nonzero exit still throws with stderr in the message; cancellation is checked before start, kills the process, and is rechecked after exit; the process is disposed.
- Test: the fake llvm-objdump in
ExtractTypeMapKeysFromNativeAotObjectTestswrites stdout, then 10,000 stderr lines, and waits forSignalingWriterto see output before exiting 0. With streaming restored, that sequence completes and stdout issymbol output\n. - Unchanged paths: the relocations path still uses a plain
StringWriter, and llvm-readobj stays onProcess.RunAndCaptureTextAsyncas described. None of the 7 newer commits onmaintouch this file,ProcessUtils.csor the test.
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.
Context: #12988
Context: #13515
On macOS and Linux,
ObjdumpStreamsOutputBeforeProcessExitinExtractTypeMapKeysFromNativeAotObjectTestsfails:#12988 added this test to check that
<ExtractTypeMapKeysFromNativeAotObject/>reads llvm-objdump stdout while the process is still running, and keptRunObjdumpAsynconProcessUtils.StartProcessfor that reason. #13515 switchedRunObjdumpAsynctoProcess.RunAndCaptureTextAsync, which buffers all of stdout until the process exits. The fake llvm-objdump in the test waits for the task to consume its output, times out, and exits with code 1.CI did not catch this: Microsoft.Android.Build.Tasks.Tests only runs on Windows, where the test is skipped because the fake llvm-objdump is a shell script.
RunObjdumpAsyncgoes back toProcessUtils.StartProcess, as before #13515. llvm-readobj still usesProcess.RunAndCaptureTextAsync; its output is parsed as one JSON document.Validation on macOS:
dotnet test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj -c Release -p:_AndroidTreatWarningsAsErrors=true --filter "Name=ObjdumpStreamsOutputBeforeProcessExit": failed (1/1) before the fix, passed (1/1) after.dotnet test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj -c Release -p:_AndroidTreatWarningsAsErrors=true --no-build --filter "FullyQualifiedName~ExtractTypeMapKeysFromNativeAotObjectTests": passed (24/24).