RAR node: Buffer log events to client - #12558
#12558Merged
YuliiaKovalova merged 2 commits intoNov 20, 2025
dotnet:maindotnet/msbuild:mainfrom
ccastanedaucf:dev/chcasta/rar-buffered-loggingccastanedaucf/msbuild:dev/chcasta/rar-buffered-loggingCopy head branch name to clipboard
Merged
RAR node: Buffer log events to client#12558YuliiaKovalova merged 2 commits intodotnet:maindotnet/msbuild:mainfrom ccastanedaucf:dev/chcasta/rar-buffered-loggingccastanedaucf/msbuild:dev/chcasta/rar-buffered-loggingCopy head branch name to clipboard
YuliiaKovalova merged 2 commits into
dotnet:maindotnet/msbuild:mainfrom
ccastanedaucf:dev/chcasta/rar-buffered-loggingccastanedaucf/msbuild:dev/chcasta/rar-buffered-loggingCopy head branch name to clipboard
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements buffered logging for the out-of-process RAR (ResolveAssemblyReference) node to improve performance by reducing IPC overhead. The implementation uses channels to batch log events asynchronously before sending them to the client.
- Adds a buffering mechanism using channels to batch log events before IPC transmission
- Refactors
LogMessagePacketBasefrom abstract to concrete to enable reuse across different assemblies - Updates project references to consolidate logging packet handling
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Tasks/Microsoft.Build.Tasks.csproj |
Adds new log event buffering class and moves Threading.Channels dependency to common section |
src/Tasks/AssemblyDependency/Node/RarNodeBuildEngine.cs |
Implements channel-based event buffering with async processing |
src/Tasks/AssemblyDependency/Node/RarNodeBufferedLogEvents.cs |
New packet type for batched log events |
src/Tasks/AssemblyDependency/Node/OutOfProcRarNodeEndpoint.cs |
Integrates async log processing into the RAR endpoint lifecycle |
src/Tasks/AssemblyDependency/Node/OutOfProcRarClient.cs |
Handles replay of buffered log events to the real build engine |
src/Tasks.UnitTests/AssemblyDependency/Node/RarNodeExecuteRequest_Tests.cs |
Updates tests to accommodate new constructor requirements |
src/Shared/LogMessagePacketBase.cs |
Refactors from abstract to concrete class with virtual methods for customization |
src/MSBuildTaskHost/MSBuildTaskHost.csproj |
Removes redundant LogMessagePacket reference |
src/MSBuild/OutOfProcTaskHostNode.cs |
Updates to use concrete LogMessagePacketBase |
src/MSBuild/MSBuild.csproj |
Removes LogMessagePacket.cs from project |
src/MSBuild/LogMessagePacket.cs |
File deleted as functionality moved to shared base |
src/Build/BackEnd/Components/Communications/LogMessagePacket.cs |
Moves specialized serialization logic from base class to concrete implementation |
ccastanedaucf
marked this pull request as draft
September 22, 2025 17:47
ccastanedaucf
force-pushed
the
dev/chcasta/rar-buffered-logging
branch
from
November 18, 2025 23:40
62d635a to
74bb593
Compare
ccastanedaucf
marked this pull request as ready for review
November 18, 2025 23:40
Contributor
Author
|
fyi this is identical to the drafted version, just minus the duplicated commits that are now merged to main |
YuliiaKovalova
approved these changes
Nov 19, 2025
This was referenced Nov 21, 2025
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.
Implements logging for out-of-proc RAR node.
Context
Since RAR is often the largest source of events in MSBuild, some complexity is needed to avoid introducing
overhead from excessive allocations and task context-switching. The main goals here are:
the final response packet.
will immediately return a struct ValueTask.
As such, two channels are used: one for events, and one for the batch size.
When an event is queued, a pending count is incremented. When the count reaches the batch threshold, or the queue
is explicitly flushed, the count is written to the count channel and reset.
Once RAR completes, events are flushed with the remaining count.