Skip to content

Conversation

MackinnonBuck
Copy link
Member

Fixes an issue where the CSS bundle wasn't getting regenerated when a change to a CSS file was made during a dotnet watch session.

Fixes https://github.com/dotnet/AspNetCore-ManualTests/issues/2776

@MackinnonBuck MackinnonBuck added the Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch label Jul 12, 2024
@ghost ghost added the untriaged Request triage from a team member label Jul 12, 2024
Copy link
Contributor

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

internal static string ComputeIntegrity(string identity, string originalItemSpec)
{
var file = File.Exists(identity) ?
using var file = File.Exists(identity) ?
Copy link
Member Author

Choose a reason for hiding this comment

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

@javiercn When using the locally-built SDK, I wasn't able to reproduce the issue where the file was left in use between hot reload edits. But I've gone ahead and made this change anyway in case it was the culprit.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also confirmed that we do take this code path when making CSS changes:

(fingerprint, integrity) = (StaticWebAsset.ComputeFingerprintAndIntegrity(candidate.ItemSpec, originalItemSpec));

Which means that this extra using theoretically shouldn't make a difference.

But it could have been that for some reason this path was being taken earlier, when I observed that hot reload was breaking. And now that the other code path is taken, everything works.

@MackinnonBuck
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@MackinnonBuck
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@MackinnonBuck MackinnonBuck merged commit a81408e into main Jul 16, 2024
@MackinnonBuck MackinnonBuck deleted the mbuck/fix-css-hot-reload branch July 16, 2024 23:49
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 untriaged Request triage from a team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants