Skip to content

Preserve whitespace paths in static web asset tasks - #55266

Merged
OvesN merged 4 commits into
mainfrom
dev/veronikao/fix-whitespace-path-guards
Jul 24, 2026
Merged

Preserve whitespace paths in static web asset tasks#55266
OvesN merged 4 commits into
mainfrom
dev/veronikao/fix-whitespace-path-guards

Conversation

@OvesN

@OvesN OvesN commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Context

Whitespace-only paths are valid on Unix, but only when the downstream file operations accepted them before task migration. In previous task migration the chose of using "isNullOrWhitespace" over "isNullOrEmpty" guard was done incorrectly in some cases.

Changes Made

Use IsNullOrEmpty for four direct-write tasks.
Keep IsNullOrWhiteSpace in ConcatenateCssFiles because its directory creation previously rejected whitespace, so absolutizing it would change behavior.

Testing

  • Separate Windows failure and Unix success tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 44aacce5-4a69-493c-989a-6bacbe193e08
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

OvesN added 3 commits July 14, 2026 12:30
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 44aacce5-4a69-493c-989a-6bacbe193e08
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 44aacce5-4a69-493c-989a-6bacbe193e08
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 44aacce5-4a69-493c-989a-6bacbe193e08
@OvesN
OvesN marked this pull request as ready for review July 21, 2026 08:28
@OvesN
OvesN requested a review from a team as a code owner July 21, 2026 08:28
Copilot AI review requested due to automatic review settings July 21, 2026 08:28
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Static Web Assets MSBuild tasks to preserve whitespace-only relative paths (valid on Unix) by switching path checks from IsNullOrWhiteSpace to IsNullOrEmpty for direct-write tasks, while keeping ConcatenateCssFiles’s stricter behavior to avoid changing its historical failure mode.

Changes:

  • Switch several tasks’ path absolutization guards to string.IsNullOrEmpty(...) so whitespace-only paths are still resolved via TaskEnvironment.GetAbsolutePath(...).
  • Add OS-specific tests that validate whitespace-only path behavior: fail on Windows, succeed (and resolve relative to TaskEnvironment.ProjectDirectory) on Unix.
  • Refactor existing multi-threading tests to share assertions/helpers and reduce duplication.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetsGeneratePackagePropsFileMultiThreadingTest.cs Adds Windows-failure vs Unix-success coverage for whitespace BuildTargetPath and refactors shared assertions.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetsPropsFileMultiThreadingTest.cs Adds OS-specific whitespace TargetPropsFilePath tests and refactors assertion logic.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestMultiThreadingTest.cs Adds OS-specific whitespace Manifest/Cache path tests ensuring resolution against TaskEnvironment.ProjectDirectory.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetEndpointsPropsFileTest.cs Adds OS-specific whitespace TargetPropsFilePath tests and factors task creation into a helper.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ConcatenateCssFilesMultiThreadingTest.cs Adds regression test ensuring whitespace OutputFile still fails (preserving pre-migration behavior) and refactors assertions.
src/StaticWebAssetsSdk/Tasks/StaticWebAssetsGeneratePackagePropsFile.cs Uses IsNullOrEmpty to allow whitespace-only BuildTargetPath to be absolutized.
src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetsPropsFile.cs Uses IsNullOrEmpty to allow whitespace-only TargetPropsFilePath to be absolutized.
src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetsManifest.cs Uses IsNullOrEmpty so whitespace-only Manifest/Cache paths are treated as configured and absolutized.
src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetEndpointsPropsFile.cs Uses IsNullOrEmpty to allow whitespace-only TargetPropsFilePath to be absolutized.

@OvesN
OvesN merged commit aa2ca0b into main Jul 24, 2026
30 checks passed
@OvesN
OvesN deleted the dev/veronikao/fix-whitespace-path-guards branch July 24, 2026 12:00
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 26, 2026
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