Skip to content

Structure RAR conflict diagnostics in binary logs - #14601

Merged
baronfel merged 9 commits into
mainfrom
baronfel-structure-rar-conflicts
Sep 17, 2026
Merged

baronfel merged 9 commits into
mainfrom
baronfel-structure-rar-conflicts

Conversation

@baronfel

@baronfel baronfel commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Stack dependency

This draft PR depends on #14599 and targets its baronfel-analyze-binlog-size branch. PR #14599 introduces structured RAR search-trace events and binary-log format 28. Review and merge #14599 first.

This PR also uses format 28 because both record types are unshipped and their length-prefixed records remain forward-skippable.

Motivation

RAR emitted 2,126 conflict dependency-list messages in the analyzed 823.6 MiB binary log. Those messages contained 992,063,604 characters (about 946 MiB of uncompressed text).

The structured model contains 1,949 unique strings and 13,560,767 wire bytes. In the category-specific measurement, gzip size decreased from 49,133,718 bytes to 1,281,821 bytes: a 45.6 MiB (97.4%) reduction for this category. Whole-log savings remain workload-dependent.

Changes

  • Add structured events for low-importance conflict details and aggregated MSB3277 warnings.
  • Transport only structured conflict fields. Do not transport rendered messages or localized format strings.
  • Lazily render BuildEventArgs.Message in invariant English for stable IPC and binary-log replay.
  • Expose FormatMessage(CultureInfo) on each structured conflict event so consumers can render another culture when needed.
  • Cache resource formats once per culture and cache the latest localized message per event. Multiple built-in loggers using the same event and culture reuse the same string.
  • Re-localize accepted events in the console, parallel console, terminal, forwarding terminal, and warning-policy paths using CurrentUICulture. Importance filtering still occurs before rendering.
  • Preserve MSB3277 fields and warning promotion, event boundaries, escaped includes, ProjectFile, task-node locations, help keywords, and OutputUnresolvedAssemblyConflicts metadata.
  • Support node packets, multi-node task-host forwarding, and out-of-process RAR transport. Unknown future task-host event types remain nonfatal.
  • Gate the structured conflict event-type change behind ChangeWave 18.12. Disabling the wave restores the legacy localized plain-text events.

Compatibility and incremental payload impact

Removing the nine conflict format strings saves 549 bytes per warning event and 221 bytes per dependency-detail event on IPC. At 1,000 / 100,000 / 100,000,000 events, that is:

Event 1,000 100,000 100,000,000
Dependency detail 221 KB 22.1 MB 22.1 GB
Warning 549 KB 54.9 MB 54.9 GB

In raw binlogs, string-table deduplication makes the incremental savings smaller: approximately 8 bytes per detail event and 18 bytes per warning event, plus about 225 or 558 one-time bytes for the corresponding format strings. Repeated-reference savings are therefore approximately 8 KB / 0.8 MB / 0.8 GB for detail events and 18 KB / 1.8 MB / 1.8 GB for warnings at the same scales. Compressed-binlog savings are smaller because repeated indices compress well.

Filtered events perform no rendering work. Invariant output renders once and caches in Message; non-invariant output performs one resource-based render per accepted event/culture and caches the result.

Validation

  • Full Debug build completed with 0 warnings and 0 errors (60.binlog).
  • 52 focused conflict and search-trace tests passed across net11.0 and net472, with 0 failures and 0 skips.
  • Bootstrap build of src\Samples\Dependency\Dependency.csproj completed with 0 warnings and 0 errors (61.binlog).
  • Coverage includes invariant laziness, French console/terminal rendering, per-culture cache reuse, serialization, task-host forwarding, ChangeWave behavior, warning policy, metadata, and large structured events.

@baronfel
baronfel force-pushed the baronfel-structure-rar-conflicts branch from 6727ccc to 6cc908b Compare August 27, 2026 19:57
@baronfel
baronfel marked this pull request as ready for review August 27, 2026 20:14
Copilot AI lite review requested due to automatic review settings August 27, 2026 20:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces .binlog size and improves replay fidelity by replacing large, preformatted ResolveAssemblyReference (RAR) conflict diagnostics with new structured BuildEventArgs types that are serialized into the binary log (format bump to 29) and transported across nodes/out-of-proc RAR.

Changes:

  • Introduces structured conflict events (AssemblyConflictDependencyDetailsMessageEventArgs, AssemblyConflictWarningEventArgs) and uses them in RAR behind ChangeWave 18.11, preserving legacy text via lazy formatting.
  • Extends binary logger serialization/deserialization and node packet plumbing to support the new event record kinds and transport paths (task host + out-of-proc RAR).
  • Adds unit tests covering roundtrip serialization, lazy formatting behavior, task host forwarding, out-of-proc dispatch, and ChangeWave opt-out/legacy text equivalence.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/UnitTests.Shared/MockEngine.cs Adds warnings-as-errors support for tests via IBuildEngine8.ShouldTreatWarningAsError.
src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs Emits new structured conflict events (and warning aggregation/promotion behavior) behind ChangeWave 18.11.
src/Tasks/AssemblyDependency/Node/OutOfProcRarClient.cs Dispatches out-of-proc RAR logged events by runtime type (supports new structured events).
src/Tasks.UnitTests/AssemblyDependency/Node/OutOfProcRarNode_Tests.cs Adds a regression test ensuring structured conflict events are dispatched correctly.
src/Tasks.UnitTests/AssemblyDependency/AssemblyConflictLogging_Tests.cs New tests validating legacy-text equivalence, filters, metadata, escaping, and warning promotion behavior under the ChangeWave.
src/Shared/LogMessagePacketBase.cs Adds new LoggingEventType IDs and instantiation mapping for the structured conflict events.
src/Framework/AssemblyReferenceConflictEventArgs.cs Adds new public conflict event args + supporting structured data types and lazy message formatting.
src/Build/Logging/BinaryLogger/BuildEventArgsWriter.cs Serializes the new structured conflict record kinds into binlog format 29.
src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs Deserializes the new structured conflict record kinds and preserves ProjectFile on replay.
src/Build/Logging/BinaryLogger/BinaryLogRecordKind.cs Adds record kinds for structured conflict dependency details and warnings.
src/Build/Logging/BinaryLogger/BinaryLogger.cs Bumps binlog format version to 29 and documents the new record kinds.
src/Build/Instance/TaskFactories/TaskHostTask.cs Refactors task-host log forwarding to dispatch by event runtime type (including telemetry/custom events).
src/Build.UnitTests/BuildEventArgsSerialization_Tests.cs Adds roundtrip + lazy-materialization tests for new structured conflict event args.
src/Build.UnitTests/BackEnd/TaskHost_Tests.cs Adds multi-node forwarding tests for the new structured conflict events.
src/Build.UnitTests/BackEnd/NodePackets_Tests.cs Validates node packet typing/translation for the new structured conflict events.
src/Build.UnitTests/AssemblyConflictTestData.cs Provides shared message-format test data for structured conflict tests.
documentation/wiki/ChangeWaves.md Documents the new ChangeWave 18.11 RAR structured conflict diagnostics and binlog format impact.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread documentation/wiki/ChangeWaves.md Resolved
@AlesProkop

Copy link
Copy Markdown
Member

Measured with separate PerfStar conflict-detail and MSB3277 stress scenarios: eight conflicts × 768 dependees, three measured iterations, Windows/Linux, normal and /mt.

Comparing the serialization-only run 15290127 with #14599+#14601 15290128:

  • conflict-detail binlogs were 6.08–6.44% smaller (about 540–553 KB → 506–519 KB);
  • MSB3277-warning binlogs were 6.38–6.84% smaller (about 541–552 KB → 504–515 KB).

Replay preserved the rendered payloads and replaced each set of eight legacy messages/warnings with eight structured events.

@baronfel
baronfel force-pushed the baronfel-structure-rar-conflicts branch from 6cc908b to 39d473d Compare September 11, 2026 21:16

@AlesProkop AlesProkop left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me now after you resolve the conflicts.

@baronfel
baronfel force-pushed the baronfel-structure-rar-conflicts branch from 39d473d to c4dd9c5 Compare September 14, 2026 17:24
@baronfel

Copy link
Copy Markdown
Member Author

@AlesProkop ok, rebased and good to go!

baronfel pushed a commit that referenced this pull request Sep 14, 2026
## Learning atom

- **What:** Refined the existing "Adding New Build Event Types" guidance
in `.github/skills/maintaining-binary-log-compatibility/SKILL.md` to
require tracing new events through every dispatcher and transport,
including task-host forwarding, while preserving non-fatal handling for
unknown event types.
- **Why:** Review of #14599 found a newly serialized event missing from
`TaskHostTask.HandleLoggedMessage`; review of #14601 found unsupported
logging events could become fatal in a forwarding path. Both are
instances of serialization being updated without validating the complete
event route.
- **Deduplication:** Existing atoms cover serialization/replay round
trips and forwarding completeness separately, but none connects new
event types to every forwarding/dispatch path or calls out preserving
unknown-event behavior.

## Reviewers (core MSBuild team)
Suggested reviewers — core-team members who discussed this pattern
(please assign): ``@dotnet/kitten``

> [!WARNING]
> <details>
> <summary>Firewall blocked 1 domain</summary>
>
> The following domain was blocked by the firewall during workflow
execution:
>
> - `github.com`
>
> To allow these domains, add them to the `network.allowed` list in your
workflow frontmatter:
>
> ```yaml
> network:
>   allowed:
>     - defaults
>     - "github.com"
> ```
>
> See [Network
Configuration](https://github.github.com/gh-aw/reference/network/) for
more information.
>
> </details>

> Generated by [Dreaming (learning atoms
curation)](https://github.com/dotnet/msbuild/actions/runs/34888369620) ·
copilot · gpt56 · 85.9 AIC · ⌖ 9.11 AIC · ⊞ 24.2K ·
[◷](https://github.com/search?q=repo%3Adotnet%2Fmsbuild+%22gh-aw-workflow-id%3A+dreaming.agent%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: Dreaming (learning atoms curation), engine:
copilot, model: gpt-5.6-sol, id: 34888369620, workflow_id:
dreaming.agent, run:
https://github.com/dotnet/msbuild/actions/runs/34888369620 -->

<!-- gh-aw-workflow-id: dreaming.agent -->
<!-- gh-aw-workflow-call-id: dotnet/msbuild/dreaming.agent -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
@baronfel
baronfel force-pushed the baronfel-structure-rar-conflicts branch 2 times, most recently from e797d42 to 78db700 Compare September 16, 2026 14:42
@baronfel
baronfel force-pushed the baronfel-structure-rar-conflicts branch 2 times, most recently from 78db700 to a054305 Compare September 16, 2026 19:14
Base automatically changed from baronfel-analyze-binlog-size to main September 17, 2026 14:59
Replace enormous conflict dependency-list strings with lazy structured events whose repeated identities, paths, dependees, and item specs use the binary log string table. Preserve legacy rendering and warning behavior behind ChangeWave 18.11, and advance the binlog format to v29.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: aa22c3ca-3e39-4cf7-9fd7-666cc172d93d
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: aa22c3ca-3e39-4cf7-9fd7-666cc172d93d
Rewrite the ChangeWave entry, public XML documentation, implementation comments, and test descriptions with concise technical language. Clarify reader compatibility and lazy message behavior without changing product behavior.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: aa22c3ca-3e39-4cf7-9fd7-666cc172d93d
baronfel and others added 6 commits September 17, 2026 09:59
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 555d1cfc-988c-49d3-b17f-81c8593ece36
Remove conflict format strings from IPC and binary-log payloads. Render structured messages invariantly by default, while built-in console and terminal loggers relocalize accepted events in the active UI culture.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 555d1cfc-988c-49d3-b17f-81c8593ece36
Use the generalized static forwarding helper introduced by the structured conflict event handling.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 555d1cfc-988c-49d3-b17f-81c8593ece36
Cache conflict message formats per culture and expose culture-aware event formatting so multiple user-facing loggers reuse localized output without materializing the invariant message.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 555d1cfc-988c-49d3-b17f-81c8593ece36
Preserve the Wave 18.12 compatibility guard before dispatching TaskHost events by their runtime type. This keeps structured event forwarding while restoring legacy event filtering when the wave is disabled.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: aa22c3ca-3e39-4cf7-9fd7-666cc172d93d
@baronfel
baronfel force-pushed the baronfel-structure-rar-conflicts branch from a054305 to 5502297 Compare September 17, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants