Skip to content

Sidecar fix for CLR2 runtime + respect nodereuse from buildparams#12416

Merged
YuliiaKovalova merged 10 commits intomainfrom
dev/ykovalova/sidecar_fix
Aug 29, 2025
Merged

Sidecar fix for CLR2 runtime + respect nodereuse from buildparams#12416
YuliiaKovalova merged 10 commits intomainfrom
dev/ykovalova/sidecar_fix

Conversation

@YuliiaKovalova
Copy link
Member

@YuliiaKovalova YuliiaKovalova commented Aug 25, 2025

Context

The introduction of sidecar taskhost functionality exposed compatibility issues with legacy scenarios and configuration settings. Node reuse was being enabled inappropriately, causing handshake failures and ignoring user preferences.
Key Issues Identified:

  • CLR2 Incompatibility: Legacy MSBuildTaskHost processes running on CLR2 (.NET Framework 2.0/3.5) don't support node reuse due to process isolation and cross-process communication limitations
  • Configuration Override: The system was not properly respecting the BuildParameters.EnableNodeReuse setting when users explicitly disabled node reuse through /nodereuse arg.

Changes Made

Implemented comprehensive node reuse validation to ensure node reuse is only enabled when all conditions are satisfied:

  • No explicit task host factory was requested by the user
  • BuildParameters.EnableNodeReuse is set to true
  • Target runtime is not CLR2

Copilot AI review requested due to automatic review settings August 25, 2025 18:30
Copy link
Contributor

Copilot AI left a comment

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 fixes a handshake failure in MSBuild's sidecar taskhost functionality by addressing node reuse compatibility issues with legacy task hosts. The primary issue was that parent MSBuild processes attempted to enable node reuse with CLR2 task hosts that don't support this feature.

Key Changes:

  • Refactored node reuse logic by extracting complex boolean conditions into a dedicated method for better maintainability
  • Added automatic detection and disabling of node reuse for legacy CLR2 runtime
  • Fixed minor spelling and naming issues in comments and test method names

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Shared/CommunicationsUtilities.cs Fixed spelling error and added legacy runtime/architecture checks to disable node reuse
src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Extracted node reuse logic into dedicated method with legacy scenario detection
src/Build.UnitTests/BackEnd/TaskHostFactory_Tests.cs Fixed test method name capitalization
src/Build.UnitTests/BackEnd/ProcessIdTaskSidecar.cs Added missing period to comment

@YuliiaKovalova YuliiaKovalova changed the title Sidecar fix Nodereuse fix for legacy processes after sidecar introduction Aug 25, 2025
@YuliiaKovalova YuliiaKovalova marked this pull request as draft August 26, 2025 19:27
@ghost ghost mentioned this pull request Aug 28, 2025
@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/sidecar_fix branch from 8d1925a to 2a54cb7 Compare August 28, 2025 16:14
@YuliiaKovalova YuliiaKovalova changed the title Nodereuse fix for legacy processes after sidecar introduction Nodereuse fix for legacy processes after sidecar introduction + respect nodereuse from buildparams Aug 28, 2025
@YuliiaKovalova YuliiaKovalova marked this pull request as ready for review August 28, 2025 16:36
@YuliiaKovalova YuliiaKovalova changed the title Nodereuse fix for legacy processes after sidecar introduction + respect nodereuse from buildparams Sidecar fix for CRL2 runtime + respect nodereuse from buildparams Aug 28, 2025
@YuliiaKovalova YuliiaKovalova changed the title Sidecar fix for CRL2 runtime + respect nodereuse from buildparams Sidecar fix for CLR2 runtime + respect nodereuse from buildparams Aug 28, 2025
@YuliiaKovalova YuliiaKovalova merged commit 521809a into main Aug 29, 2025
9 checks passed
@YuliiaKovalova YuliiaKovalova deleted the dev/ykovalova/sidecar_fix branch August 29, 2025 07:54
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