Fix ShouldTreatWarningAsError in OOP TaskHost checking wrong collection#13440
Fix ShouldTreatWarningAsError in OOP TaskHost checking wrong collection#13440JanProvaznik merged 6 commits intomainfrom
Conversation
|
Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo. |
…st, gated behind ChangeWave 18.6 Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/msbuild/sessions/03b30797-b232-48c5-a710-7361a11ff69d
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/msbuild/sessions/03b30797-b232-48c5-a710-7361a11ff69d
…tests Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/msbuild/sessions/c040bcf1-9dab-4b98-9019-bb39ce5175ab
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/msbuild/sessions/c040bcf1-9dab-4b98-9019-bb39ce5175ab
There was a problem hiding this comment.
Pull request overview
Fixes a regression in out-of-proc task execution (TaskHostFactory) where OutOfProcTaskHostNode.ShouldTreatWarningAsError() checked the wrong warning-code collection, causing specific MSBuildWarningsAsErrors codes to be ignored (and potentially triggering an NRE). The behavior change is gated behind ChangeWave 18.6 and is validated with new integration tests that run a real OOP task-host path.
Changes:
- Correct
OutOfProcTaskHostNode.ShouldTreatWarningAsError()to match againstWarningsAsErrors(ChangeWave 18.6 gated). - Add OOP (
TaskHostFactory) integration tests covering specific-code, treat-all, and “message overrides error” scenarios. - Document the fix under ChangeWave 18.6.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/MSBuild/OutOfProcTaskHostNode.cs | Fixes warning-as-error matching logic for OOP task host behind ChangeWave 18.6. |
| src/Build.UnitTests/WarningsAsMessagesAndErrors_Tests.cs | Adds integration tests that execute a task via TaskHostFactory to validate OOP behavior. |
| documentation/wiki/ChangeWaves.md | Records the feature/fix as part of ChangeWave 18.6 documentation. |
Merge conflict resolution: - ShouldTreatWarningAsError: preserve ChangeWave 18.6 fix from dotnet#13440 while using EffectiveWarnings* accessors for thread-safe concurrent access Bug fix: - Replace VerifyThrowArgument('General.TwoVectorsMustHaveSameLength') with VerifyThrow in 7-param BuildProjectFilesInParallel. The resource was moved from Strings.shared.resx to Build/Resources/Strings.resx by dotnet#13370, making it inaccessible in the OOP TaskHost process which only has MSBuild.Strings.shared. This caused MSB0001 crash on every BuildProjectFile callback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…on (dotnet#13440) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jan Provazník <janprovaznik@microsoft.com>
Context
OutOfProcTaskHostNode.ShouldTreatWarningAsError()checksWarningsAsMessagesinstead ofWarningsAsErrorswhen matching specific warning codes. This means<MSBuildWarningsAsErrors>CS0618</MSBuildWarningsAsErrors>silently fails (or NREs) when the task runs out-of-process viaTaskHostFactory.Introduced in v17.10.0 (PR #7309). The in-proc
TaskHost.cshas the correct implementation; the OOP copy diverged.MY0001)-warnaserror)Changes Made
src/MSBuild/OutOfProcTaskHostNode.cs: Fix the return line to checkWarningsAsErrors.Contains(warningCode), gated behindChangeWaves.Wave18_6documentation/wiki/ChangeWaves.md: Document the fix under 18.6src/Build.UnitTests/WarningsAsMessagesAndErrors_Tests.cs: 3 integration tests that routeCustomLogAndReturnTaskthroughTaskHostFactory(out-of-proc) with warning-as-error properties:TreatWarningsAsErrorsWhenSpecified_TaskHostFactory— specific code inMSBuildWarningsAsErrorspromotes warning to errorTreatAllWarningsAsErrors_TaskHostFactory—MSBuildTreatWarningsAsErrors=truepromotes all warnings to errorsTreatWarningAsMessageOverridesTreatingItAsError_TaskHostFactory—MSBuildWarningsAsMessagesoverridesMSBuildWarningsAsErrorsTesting
3 new integration tests in
WarningsAsMessagesAndErrors_Tests— all passing. Tests exercise the actual OOP task host path by routing tasks throughTaskHostFactory, confirming warnings are correctly promoted to errors in out-of-proc scenarios. All 31 tests in the suite (28 existing + 3 new) pass.Notes
Gated behind ChangeWave 18.6 per request, since the fix changes observable behavior (builds that previously succeeded with unpromoted warnings will now correctly fail).
Original prompt
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.