Skip to content

Refactor WebAssemblyHotReload to use the agent code from the SDK #32496

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 7, 2021

Conversation

pranavkm
Copy link
Contributor

@pranavkm pranavkm commented May 7, 2021

  • React to MetadataUpdateHandler renames

Contributes to dotnet/runtime#51545

* React to MetadataUpdateHandler renames

Contributes to dotnet/runtime#51545
@pranavkm pranavkm requested a review from a team as a code owner May 7, 2021 18:49
using System.Reflection.Metadata;
using Microsoft.AspNetCore.Components.HotReload;

[assembly: AssemblyMetadata("ReceiveHotReloadDeltaNotification", "Microsoft.AspNetCore.Components.HotReload.HotReloadManager")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unused. This was stop-gap until dotnet-watch was updated to support MetadataUpdateHandlerAttribute

using System.Linq;
using System.Reflection;

namespace Microsoft.Extensions.HotReload
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pretty identical to the code in https://raw.githubusercontent.com/dotnet/sdk/f67f46eba6d3bcf2b3054381851a975096652454/src/BuiltInTools/DotNetDeltaApplier/HotReloadAgent.cs. There's some usings that are different. Also it no longer supports the BeforeUpdate and AfterUpdate methods that dotnet-watch temporarily supports.


static WebAssemblyHotReload()
private static HotReloadAgent? _hotReloadAgent;
private static UpdateDelta[] _updateDeltas = new[]
Copy link
Member

Choose a reason for hiding this comment

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

Why is this a list if we're ever only managing a single delta at a time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to keep the HotReloadAgent code identical. Right now, the blazor webassembly hot reload, sends deltas one at a time for "reasons" so using an array works. It would be worthwhile to switch it up and have it receive all of the deltas simultaneously, but that would be a little more effort to plumb thru. Another day!

@pranavkm pranavkm merged commit 5c3ef58 into main May 7, 2021
@pranavkm pranavkm deleted the prkrishn/update-hot-reload branch May 7, 2021 21:16
@ghost ghost added this to the 6.0-preview5 milestone May 7, 2021
@pranavkm pranavkm added the area-blazor Includes: Blazor, Razor Components label May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants