Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Using Hot Reload should provide the updated types that the HotReload workspace is generating. At present time, the browserlink integration does not fill the updatedTypes parameter properly when deltas are sent.
The aspnetcore-browser-refresh.js
contains this:
let applyError = undefined;
if (window.Blazor?._internal?.applyHotReload) {
// Only apply hot reload deltas if Blazor has been initialized.
// It's possible for Blazor to start after the initial page load, so we don't consider skipping this step
// to be a failure. These deltas will get applied later, when Blazor completes initialization.
deltas.forEach(d => {
try {
window.Blazor._internal.applyHotReload(d.moduleId, d.metadataDelta, d.ilDelta, d.pdbDelta)
} catch (error) {
console.warn(error);
applyError = error;
}
});
}
And while d.updatedTypes
exists, this member is not passed to window.Blazor._internal.applyHotReload
:
Expected Behavior
updatedTypes
should not be empty when a type member is hot reloaded in Visual Studio.
Steps To Reproduce
Add the following to a blazor webassembly app:
[assembly:MetadataUpdateHandler(typeof(MyHandler))]
static class MyHandler
{
static void ClearCache(Type[]? updatedTypes)
{
Console.WriteLine("ClearCache: " + string.Join(",", updatedTypes.Select(t => t.ToString())));
}
static void UpdateApplication(Type[]? updatedTypes)
{
Console.WriteLine("UpdateApplication: " + string.Join(",", updatedTypes.Select(t => t.ToString())));
}
}
Exceptions (if any)
None.
.NET Version
8.0.100
Anything else?
It is likely that such a change will require:
To be updated to use updatedTypes
in the same fashion that dotnet/sdk uses it: