dotnet / dotnet/aspnetcore

Hot reload error [JSInvokableAttribute("ApplyHotReloadDeltas")]

Open
#61,495 2 comments 6 reactions 0 assignees View on GitHub
area-commandlinetools feature-hot-reload
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Description:

I'm facing an issue with the Hot Reload feature in ASP.NET Core. Changes made to .razor components are not being reflected in the application during development, even with the Hot Reload option enabled and active.

```
dotnet watch ⌚ Updating diagnostics in the browser.
dotnet watch ⌚ [GrupoSPO.WebApp (net9.0)] Using capabilities based on target framework: '9.0'.
dotnet watch 🕵️ [6fbd4ac4-0007-42d3-86f7-d039cd7a3a1c] ResponseLoggingLevel = Verbose
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/2 POST https://[::1]:5001/_framework/blazor-hotreload - application/json 52031
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/2 GET https://[::1]:5001/home - - -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint '/home (/home)'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/2 POST https://[::1]:5001/_framework/blazor-hotreload - 200 0 - 1.4785ms
dotnet watch ❌ [Browser #1] The assembly 'Microsoft.AspNetCore.Components.WebAssembly' does not contain a public invokable method with [JSInvokableAttribute("ApplyHotReloadDeltas")].
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.GetCachedMethodInfo(AssemblyKey assemblyKey, String methodIdentifier)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.Invoke(JSRuntime jsRuntime, DotNetInvocationInfo& invocationInfo, String argsJson)
at Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime.InvokeDotNet(String assemblyName, String methodIdentifier, Int64 dotNetObjectId, String argsJson)
at Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime.__Wrapper_InvokeDotNet_999282461(JSMarshalerArgument* __arguments_buffer)
ManagedError@https://[::1]:5001/_framework/dotnet.runtime.cymp1amu5g.js:3:31033
sn@https://[::1]:5001/_framework/dotnet.runtime.cymp1amu5g.js:3:26894
gn@https://[::1]:5001/_framework/dotnet.runtime.cymp1amu5g.js:3:28882
gr/<@https://[::1]:5001/_framework/dotnet.runtime.cymp1amu5g.js:3:38412
invokeDotNetFromJS@https://[::1]:5001/_framework/blazor.web.js:1:157655
invokeDotNetMethod@https://[::1]:5001/_framework/blazor.web.js:1:3507
invokeDotNetStaticMethod@https://[::1]:5001/_framework/blazor.web.js:1:3263
Hr/wt._internal.applyHotReloadDeltas@https://[::1]:5001/_framework/blazor.web.js:1:163016
applyBlazorDeltas@https://[::1]:5001/_framework/aspnetcore-browser-refresh.js:234:15
BlazorHotReloadDeltav3@https://[::1]:5001/_framework/aspnetcore-browser-refresh.js:49:58
connection.onmessage@https://[::1]:5001/_framework/aspnetcore-browser-refresh.js:57:29

info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint '/home (/home)'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/2 GET https://[::1]:5001/home - 200 - text/html;+charset=utf-8 12.0396ms
dotnet watch 🕵️ [GrupoSPO.WebApp (net9.0)] Applying delta to module 86296d76-d934-4d93-99a2-f1fe2c7d5ccc.
dotnet watch 🕵️ [GrupoSPO.WebApp (net9.0)] Invoking metadata update handlers.
dotnet watch 🕵️ [GrupoSPO.WebApp (net9.0)] Deltas applied.
```
Browser console:

```
Error: The assembly 'Microsoft.AspNetCore.Components.WebAssembly' does not contain a public invokable method with [JSInvokableAttribute("ApplyHotReloadDeltas")].
[aspnetcore-browser-refresh.js:240:15](https://[::1]:5001/_framework/aspnetcore-browser-refresh.js)
Error: The assembly 'Microsoft.AspNetCore.Components.WebAssembly' does not contain a public invokable method with [JSInvokableAttribute("ApplyHotReloadDeltas")].
[aspnetcore-browser-refresh.js:240:15](https://[::1]:5001/_framework/aspnetcore-browser-refresh.js)
```

### Expected Behavior

Update the page!?

### Steps To Reproduce

Open project.
Change any file .razor and save.

### Exceptions (if any)

_No response_

### .NET Version

9.0.203

### Anything else?

dotnet --info

```
.NET SDK:
Version: 9.0.203
Commit: dc7acfa194
Workload version: 9.0.200-manifests.12d79ccf
MSBuild version: 17.13.20+a4ef1e90f

Ambiente de runtime:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.203\
```
VS 17.13.35931.197

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure by running dotnet watch, changing a .razor file, and checking the browser console. Start with the ApplyHotReloadDeltas call in aspnetcore-browser-refresh.js and the related invocation in blazor.web.js; done means the page updates without the missing JSInvokable method error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, javascript
Domain
frontend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.