-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Remove Identity-without-backing-file quirk from Static Web Assets #53819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,8 +12,6 @@ internal static class AssetToCompress | |||||
| { | ||||||
| public static bool TryFindInputFilePath(ITaskItem assetToCompress, TaskLoggingHelper log, out string fullPath) | ||||||
| { | ||||||
| // Check RelatedAsset first (the asset's Identity path) as it's more reliable. | ||||||
| // RelatedAssetOriginalItemSpec may point to a project file (e.g., .esproj) rather than the actual asset. | ||||||
| var relatedAsset = assetToCompress.GetMetadata("RelatedAsset"); | ||||||
| if (File.Exists(relatedAsset)) | ||||||
| { | ||||||
|
|
@@ -24,20 +22,9 @@ public static bool TryFindInputFilePath(ITaskItem assetToCompress, TaskLoggingHe | |||||
| return true; | ||||||
| } | ||||||
|
|
||||||
| var relatedAssetOriginalItemSpec = assetToCompress.GetMetadata("RelatedAssetOriginalItemSpec"); | ||||||
| if (File.Exists(relatedAssetOriginalItemSpec)) | ||||||
| { | ||||||
| log.LogMessage(MessageImportance.Low, "Asset '{0}' found at original item spec '{1}'.", | ||||||
| assetToCompress.ItemSpec, | ||||||
| relatedAssetOriginalItemSpec); | ||||||
| fullPath = relatedAssetOriginalItemSpec; | ||||||
| return true; | ||||||
| } | ||||||
|
|
||||||
| log.LogError("The asset '{0}' can not be found at any of the searched locations '{1}' and '{2}'.", | ||||||
| log.LogError("The asset '{0}' can not be found at the searched location '{1}'.", | ||||||
|
||||||
| log.LogError("The asset '{0}' can not be found at the searched location '{1}'.", | |
| log.LogError("The asset '{0}' cannot be found at the searched location '{1}'.", |
Copilot
AI
Apr 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TryFindInputFilePath logs a "not found" error even when RelatedAsset metadata is empty, which produces an unclear message (searched location ''). Consider explicitly checking string.IsNullOrWhiteSpace(relatedAsset) first and logging a targeted error that the required RelatedAsset metadata is missing/empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StaticWebAsset.ResolveFile now returns a FileInfo without validating existence. Callers like ApplyDefaults/ComputeIntegrity will then fail later with FileNotFoundException (or when accessing Length), which is less actionable than the previous targeted InvalidOperationException. Consider reintroducing an explicit Exists check here (and throwing a clear exception that includes the asset Identity) to keep failures deterministic and diagnosable.