Repository navigation
Migrate UpdatePackageStaticWebAssets to IMultiThreadableTask - #54707
jankratochvilcz merged 3 commits into
Conversation
|
Thanks for your PR, @jankratochvilcz. |
Follow-up: deeper call-stack audit (call paths into StaticWebAsset)Tracing all helpers invoked from
Both Why it doesn't bite in practice today: in production the SDK targets that produce these items populate Why not fix it here: |
No decoy-style unit test added — not viable hereThis is an attribute-only opt-in. A decoy-CWD test of the form used for |
Failing test added (Skip = dotnet/msbuild#14036)Added What it does (decoy pattern):
Locally verified (with confirming that The test is committed with |
|
Foundation PR opened: #54708 adds the |
2de1a29 to
0b19d57
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates UpdatePackageStaticWebAssets to MSBuild’s multi-threadable task model by opting in via [MSBuildMultiThreadableTask] and flowing TaskEnvironment into path normalization/materialization logic, with a focused regression test to ensure behavior does not depend on the process current working directory.
Changes:
- Mark
UpdatePackageStaticWebAssetsas multi-threadable and implementIMultiThreadableTaskwith aTaskEnvironmentproperty. - Pass
TaskEnvironmentthroughStaticWebAsset.FromV1TaskItem(...)andStaticWebAsset.MaterializeFrameworkAsset(...)to avoid process-CWD-based resolution. - Add a unit test that sets a “decoy” process CWD and verifies
ContentRootis normalized relative toTaskEnvironment.ProjectDirectory.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/UpdatePackageStaticWebAssetsMultiThreadingTest.cs | Adds coverage ensuring relative ContentRoot normalization is rooted in TaskEnvironment.ProjectDirectory (not process CWD). |
| src/StaticWebAssetsSdk/Tasks/UpdatePackageStaticWebAssets.cs | Opts task into MSBuild multi-threading and threads TaskEnvironment into static web asset normalization/materialization. |
AlesProkop
left a comment
There was a problem hiding this comment.
Looks good. I would just trim some of the commentary as it seems quite verbose. If you do not agree, I am ok with merging as is.
Marks the task with [MSBuildMultiThreadableTask] so MSBuild's multithreaded mode skips the per-task TaskHost wrapper. The task body merges package asset metadata purely in memory, so attribute-only opt-in is sufficient per the migration skill. Co-authored-by: Copilot <[email protected]>
…(Skip referencing dotnet/msbuild#14036) Demonstrates the transitive call-stack hazard: StaticWebAsset.FromV1TaskItem -> Normalize() -> Path.GetFullPath(ContentRoot) leaks the process CWD into output ContentRoot when ContentRoot is supplied as a relative path. The test is marked Skip because the per-task migration cannot fix the StaticWebAsset data type; tracking dotnet/msbuild#14036. Locally verified that removing the Skip causes a clean assertion failure pointing at the decoy CWD. Co-authored-by: Copilot <[email protected]>
- Shorten class-level comment to one line - Remove duplicate inline comment on ContentRoot metadata - Use .Be(projectContentRoot + DirectorySeparatorChar) for stricter assertion Co-authored-by: Copilot <[email protected]>
45e14cb to
17466f7
Compare
|
/azp run dotnet-sdk-public-ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Migrates
UpdatePackageStaticWebAssets(src/StaticWebAssetsSdk/Tasks/UpdatePackageStaticWebAssets.cs) to multi-threadable by adding[MSBuildMultiThreadableTask].Fixes dotnet/msbuild#14035
Perfstar regression (14d, Windows, paired MT vs non-MT, p50 sum across iterations)
UpdateExistingPackageStaticWebAssetsChanges
[MSBuildMultiThreadableTask]on the concrete class. NoIMultiThreadableTaskplumbing needed — the task body merges existing package asset metadata into new asset items purely via dictionary lookups (no filesystem / environment / process I/O).Compatibility sins audit (per migration skill)
24/24 dimensions clean — attribute-only opt-in.
Co-authored-by: Copilot [email protected]