Preserve whitespace paths in static web asset tasks - #55266
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 44aacce5-4a69-493c-989a-6bacbe193e08
|
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. |
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
|
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. |
Contributor
There was a problem hiding this comment.
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 viaTaskEnvironment.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. |
AlesProkop
approved these changes
Jul 22, 2026
jankratochvilcz
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
IsNullOrEmptyfor four direct-write tasks.Keep
IsNullOrWhiteSpaceinConcatenateCssFilesbecause its directory creation previously rejected whitespace, so absolutizing it would change behavior.Testing