Skip to content

Blazor Hot Reload not working [JSInvokableAttribute("ApplyHotReloadDeltas")] error #61796

Open
@divvjson

Description

@divvjson

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

After we make a code change and try to run "Hot Reload", we get the following error message:
Error: The assembly 'Microsoft.AspNetCore.Components.WebAssembly' does not contain a public invokable method with [JSInvokableAttribute("ApplyHotReloadDeltas")].

This error message appears both in the Output window in Visual Studio and in the browser console.

We always get this error message, meaning that Hot Reload never works in any context in our solution.

Here’s a description of our solution:
We have an Aspire solution consisting of multiple projects, two of which are Blazor applications.

We can refer to the Blazor applications as:

OAuth (Blazor Web App – Per page/component interactive, mostly static pages)

Customer Portal (Blazor Web App – Global WebAssembly with prerender: false)

We have implemented an OAuth authentication flow. In short, when a user navigates to the Customer Portal, they are immediately redirected to the OAuth site. If they are already signed in, they are redirected back to the Customer Portal; otherwise, they log in and are then redirected back to the Customer Portal site.

The reason I mention this is because I suspect it might be related to why Hot Reload is not working, but I'm not sure.

I have created a new Aspire solution with a Blazor Web App project (same as in our solution, but without the OAuth authentication flow), and in that case, Hot Reload works.

Any idea what might be wrong?

Expected Behavior

When we make simple changes in a Blazor component, hot reload should work.

Steps To Reproduce

No response

Exceptions (if any)

15:00 29.29 MyApp.OAuth.UI (Web server): Hot reload session started
15:00 29.35 MyApp.OAuth.UI (Web assembly): Hot reload session started
15:00 29.60 MyApp.Gateway (Web server): Hot reload session started
15:00 29.87 MyApp.ServiceHooks.API (Web server): Hot reload session started
15:00 30.12 MyApp.CustomerPortal (Web server): Hot reload session started
15:00 40.87 MyApp.CustomerPortal (Web assembly): Hot reload session started
15:00 49.89 MyApp.OAuth.UI: CSS Hot Reload 2b0b7902-e84c-4f57-b421-63788f6d0d42: Tracking https://localhost:7073/css/blazor.n0eosgq6xp.css
15:00 49.99 MyApp.OAuth.UI: CSS Hot Reload 2b0b7902-e84c-4f57-b421-63788f6d0d42: Tracking https://localhost:7073/css/tailwind.compiled.4k8s5sl9ty.css
15:00 50.04 MyApp.OAuth.UI: CSS Hot Reload 2b0b7902-e84c-4f57-b421-63788f6d0d42: Tracking https://localhost:7073/css/dxbl.ogxijkxa7b.css
15:00 50.09 MyApp.OAuth.UI: CSS Hot Reload 2b0b7902-e84c-4f57-b421-63788f6d0d42: Tracking https://localhost:7073/css/app.l6uie8j1yu.css
15:00 50.13 MyApp.OAuth.UI: CSS Hot Reload 2b0b7902-e84c-4f57-b421-63788f6d0d42: Tracking https://localhost:7073/MyApp.OAuth.UI.hsmqp27665.styles.css
15:01 01.79 MyApp.CustomerPortal: CSS Hot Reload 0a87bfd9-0702-49d0-a8bf-e24be89c3119: Tracking https://localhost:7076/css/wait-indicator.bn0ief4mca.css
15:01 01.82 MyApp.CustomerPortal: CSS Hot Reload 0a87bfd9-0702-49d0-a8bf-e24be89c3119: Tracking https://localhost:7076/css/blazor.n4hpn7ta0e.css
15:01 01.92 MyApp.CustomerPortal: CSS Hot Reload 0a87bfd9-0702-49d0-a8bf-e24be89c3119: Tracking https://localhost:7076/css/tailwind.compiled.ckhrwtldxb.css
15:01 01.96 MyApp.CustomerPortal: CSS Hot Reload 0a87bfd9-0702-49d0-a8bf-e24be89c3119: Tracking https://localhost:7076/css/dxbl.ogxijkxa7b.css
15:01 02.00 MyApp.CustomerPortal: CSS Hot Reload 0a87bfd9-0702-49d0-a8bf-e24be89c3119: Tracking https://localhost:7076/css/app.26fyirsdvn.css
15:01 02.03 MyApp.CustomerPortal: CSS Hot Reload 0a87bfd9-0702-49d0-a8bf-e24be89c3119: Tracking https://localhost:7076/MyApp.CustomerPortal.lzxg93falv.styles.css
15:01 35.05 MyApp.OAuth.UI (Web assembly): Sending updates to running application
15:01 35.13 MyApp.OAuth.UI (Web assembly): Updates applied successfully
15:01 35.13 MyApp.CustomerPortal (Web assembly): Sending updates to running application
15:01 35.17 MyApp.CustomerPortal: [Error]    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)
Error: The assembly 'Microsoft.AspNetCore.Components.WebAssembly' does not contain a public invokable method with [JSInvokableAttribute("ApplyHotReloadDeltas")].
    at sn (https://localhost:7076/_framework/dotnet.runtime.cymp1amu5g.js:3:26894)
    at gn (https://localhost:7076/_framework/dotnet.runtime.cymp1amu5g.js:3:28882)
    at Object.<anonymous> (https://localhost:7076/_framework/dotnet.runtime.cymp1amu5g.js:3:38412)
    at Object.invokeDotNetFromJS (https://localhost:7076/_framework/blazor.web.js:1:157655)
    at w.invokeDotNetMethod (https://localhost:7076/_framework/blazor.web.js:1:3507)
    at w.invokeDotNetStaticMethod (https://localhost:7076/_framework/blazor.web.js:1:3263)
    at Hr.wt._internal.applyHotReloadDeltas (https://localhost:7076/_framework/blazor.web.js:1:163016)
    at applyBlazorDeltas (https://localhost:7076/_framework/aspnetcore-browser-refresh.js:234:15)
    at Object.BlazorHotReloadDeltav3 (https://localhost:7076/_framework/aspnetcore-browser-refresh.js:49:41)
    at connection.onmessage (https://localhost:7076/_framework/aspnetcore-browser-refresh.js:57:29)
15:01 35.17 MyApp.CustomerPortal (Web assembly): [Error] Applying updates to the application failed.  Additional information on why the update failed may be available in your browser's debug console window.
15:01 35.18 An unexpected error has occurred, any pending updates have been discarded.

.NET Version

9.0.203

Anything else?

We are using Visual Studio 17.13.6

Activity

ghost added
area-blazorIncludes: Blazor, Razor Components
on May 5, 2025
javiercn

javiercn commented on May 5, 2025

@javiercn
Member

@divvjson thanks for contacting us.

@tmat can you take a look?

added
feature-hot-reloadThis issue is related to the Hot Reload feaature
area-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI
and removed
area-blazorIncludes: Blazor, Razor Components
on May 5, 2025
tmat

tmat commented on May 6, 2025

@tmat
Member

@divvjson Can you share the solution source with us? You can do so via https://developercommunity.visualstudio.com/home if you don't want it to be public.

If you can't share it, what PackageReferences do you have in the WASM projects?

divvjson

divvjson commented on May 8, 2025

@divvjson
Author

@tmat I have created a issue, https://developercommunity.visualstudio.com/t/Blazor-Hot-Reload-not-working-JSInvokab/10900611?viewtype=all

It includes the source code and a video demonstrating the issue.

divvjson

divvjson commented on May 23, 2025

@divvjson
Author

@tmat Any news?

tmat

tmat commented on May 23, 2025

@tmat
Member
jkalweit

jkalweit commented on May 25, 2025

@jkalweit

"Clean Solution" and recompile worked for me.

lewing

lewing commented on May 25, 2025

@lewing
Member
FPierrel

FPierrel commented on Jun 8, 2025

@FPierrel

@tmat Any news?

It's not a fix, but it may help in the meantime.

We have the same problem, to get around it just enable the new .NET9+ Mono Debugger for WASM applications:

I'm using the preview version of VS2022, but I think the option is also present on the stable version.

Image

#61495

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPIfeature-hot-reloadThis issue is related to the Hot Reload feaature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lewing@tmat@jkalweit@FPierrel@javiercn

        Issue actions

          Blazor Hot Reload not working [JSInvokableAttribute("ApplyHotReloadDeltas")] error · Issue #61796 · dotnet/aspnetcore