Migrate ReadStaticWebAssetsManifestFile - #54791
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates ReadStaticWebAssetsManifestFile to be safe for MSBuild multi-threaded task execution by eliminating reliance on process-wide current directory when resolving the manifest path.
Changes:
- Marked
ReadStaticWebAssetsManifestFileas[MSBuildMultiThreadableTask]and implementedIMultiThreadableTaskwith aTaskEnvironmentfallback. - Resolved
ManifestPathto an absolute path viaTaskEnvironment.GetAbsolutePath()before doing file-system reads. - Added a regression test ensuring empty
ManifestPathcontinues to produce the existing “not found” error behavior instead of throwing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/StaticWebAssetsSdk/Tasks/ReadStaticWebAssetsManifestFile.cs | Makes the task MSBuild-multithread friendly by resolving manifest paths via TaskEnvironment and using the absolute path for file IO. |
| test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs | Adds a focused regression test for empty manifest path handling to ensure behavior remains stable post-migration. |
|
Reviewed this as an MSBuild multithreaded-task migration and I don't see actionable issues. The task is marked |
jankratochvilcz
left a comment
There was a problem hiding this comment.
Left a few comments, thanks for the PR!
Fixes dotnet/msbuild#14060
Context
Migrates
ReadStaticWebAssetsManifestFileto support MSBuild multithreaded task execution. The task reads the static web assets manifest from disk, so it needs to avoid resolving relative paths against process-wide current directory state.Changes Made
[MSBuildMultiThreadableTask]toReadStaticWebAssetsManifestFile.IMultiThreadableTaskand initializedTaskEnvironmentwithTaskEnvironment.Fallback.ManifestPathwithTaskEnvironment.GetAbsolutePath()before file system access.Testing
D:\msbuild\src\ThreadSafeTaskAnalyzer\ThreadSafeTaskAnalyzer.csproj.src\StaticWebAssetsSdk\Tasks\Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj.ReadStaticWebAssetsManifestFile.src\StaticWebAssetsSdk\Tasks\Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj.Microsoft.NET.Sdk.StaticWebAssets.Tests.ReadStaticWebAssetsManifestFileTest