Skip to content

Migrate ShowPreviewMessage to IMultiThreadableTask#53956

Open
SimaTian wants to merge 5 commits intodotnet:mainfrom
SimaTian:migrate-show-preview-message
Open

Migrate ShowPreviewMessage to IMultiThreadableTask#53956
SimaTian wants to merge 5 commits intodotnet:mainfrom
SimaTian:migrate-show-preview-message

Conversation

@SimaTian
Copy link
Copy Markdown
Member

@SimaTian SimaTian commented Apr 17, 2026

Migrates \ShowPreviewMessage\ to support \IMultiThreadableTask.

Changes

  • Adds [MSBuildMultiThreadableTask]\ attribute.
  • Pattern A (attribute + interface + stub TaskEnvironment): task has zero file I/O and zero env-var reads. Per-engine isolation is already provided by \BuildEngine4.GetRegisteredTaskObject/\RegisterTaskObject, which is backed by MSBuild's concurrent \RegisteredTaskObjectCache.

Supersedes

Part of the split of stuck merge-group PR #52936. This is the 5-of-5 split for \ShowPreviewMessage.

Copy link
Copy Markdown
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

Migrates ShowPreviewMessage to participate in MSBuild’s multithreaded task execution model by marking it as multithreadable and implementing IMultiThreadableTask, with accompanying unit tests validating expected behavior.

Changes:

  • Adds [MSBuildMultiThreadableTask] and implements IMultiThreadableTask on ShowPreviewMessage, including a TaskEnvironment property.
  • Introduces new unit tests covering interface implementation, guard/registration behavior, logging behavior, and per-engine isolation.

Reviewed changes

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

File Description
src/Tasks/Microsoft.NET.Build.Tasks/ShowPreviewMessage.cs Marks the task as multithreadable and adds the IMultiThreadableTask TaskEnvironment property (with NETFRAMEWORK handling).
src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAShowPreviewMessageMultiThreading.cs Adds unit tests validating multithreadable task requirements and expected logging/guard behavior.

Comment thread src/Tasks/Microsoft.NET.Build.Tasks/ShowPreviewMessage.cs Outdated
SimaTian and others added 2 commits April 29, 2026 13:41
- Add [MSBuildMultiThreadableTask] attribute to support multi-threaded execution
- Implement IMultiThreadableTask interface with TaskEnvironment property
- Conditional implementation for NETFRAMEWORK vs other targets
- Add comprehensive unit tests for multi-threading scenarios

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@OvesN OvesN marked this pull request as ready for review May 5, 2026 09:35
Comment thread src/Tasks/Microsoft.NET.Build.Tasks/ShowPreviewMessage.cs
Delegates the SDK's TaskEnvironmentDefaults and TaskEnvironmentHelper
shims to MSBuild's public TaskEnvironment.Fallback /
CreateWithProjectDirectoryAndEnvironment APIs (dotnet/msbuild#13462),
and drops the now-unused ProcessTaskEnvironmentDriver polyfill.

Pipelines are expected to fail until the consumed MSBuild API
target version is bumped to a build that exposes these APIs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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