Skip to content

[StaticWebAssets] Add file to FileWrites even when the content is the same in OverrideHtmlAssetPlaceholders #49073

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

Merged
merged 1 commit into from
May 20, 2025

Conversation

maraf
Copy link
Member

@maraf maraf commented May 20, 2025

Fixes bug with incremental clean.
We need to mark the file as "written to" even if we skipped the write because the content was the same.

@maraf maraf added this to the 10.0.1xx milestone May 20, 2025
@maraf maraf self-assigned this May 20, 2025
@Copilot Copilot AI review requested due to automatic review settings May 20, 2025 11:00
@maraf maraf added the Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch label May 20, 2025
@maraf maraf requested a review from a team May 20, 2025 11:00
Copy link
Contributor

Thanks for your PR, @@maraf.
To learn about the PR process and branching schedule of this repo, please take a look at the SDK PR Guide.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that files are marked as written in fileWrites even when their content hasn’t changed, fixing an incremental clean bug.

  • Always calls PersistFileIfChanged and unconditionally adds outputPath to fileWrites
  • Removes the conditional block around fileWrites.Add
Comments suppressed due to low confidence (1)

src/StaticWebAssetsSdk/Tasks/OverrideHtmlAssetPlaceholders.cs:97

  • Add a unit test that covers the scenario where PersistFileIfChanged returns false (unchanged content) and verifies that fileWrites still contains outputPath to prevent future regressions.
fileWrites.Add(outputPath);

@maraf maraf enabled auto-merge (squash) May 20, 2025 11:11
@maraf maraf merged commit 3aa9493 into dotnet:main May 20, 2025
32 checks passed
@maraf maraf deleted the HtmlPlaceholderFileWrites branch May 20, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants