Provide full `updateTypes` to MetadataUpdateHandlers
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] 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:
```js
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:
```csharp
[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:
https://github.com/dotnet/aspnetcore/blob/4b7810723c27d47cc982055c6615cccf664e2980/src/Components/WebAssembly/WebAssembly/src/HotReload/WebAssemblyHotReload.cs#L46
To be updated to use `updatedTypes` in the same fashion that dotnet/sdk uses it:
https://github.com/dotnet/sdk/blob/50ccc948eb082d316158b709301b28c5e7f60c01/src/BuiltInTools/DotNetDeltaApplier/HotReloadAgent.cs#L230
Contributor guide
Assessment
This issue has not been assessed yet.