Skip to content

[8.0.100-preview.5.23276.4] DotNet.jsCallDispatcher.disposeJSObjectReferenceById is missing from blazor.server.js #48513

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

Closed
1 task done
Junjun-zhao opened this issue May 30, 2023 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Milestone

Comments

@Junjun-zhao
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When run the 3rd party apps against the latest .NET 8 Preview 5 build, pages fail to load with Microsoft.JSInterop.JSException that Could not find 'DotNet.jsCallDispatcher.disposeJSObjectReferenceById'

Application Name: BlazorBlogs, Blazorise
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-8.0.100-preview.5.23276.4

App source checking at Github Link: https://github.com/ADefWebserver/Blazor-Blogs
or https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1827614

Verify Scenarios:

  1. Windows10 21h2 x64 + dotnet-sdk-8.0.100-preview.5.23273.2: Pass
  2. Windows10 21h2 x64 + dotnet-sdk-8.0.100-preview.5.23276.4: Fail
  3. Windows10 21h2 x64 + dotnet-sdk-7.0.300: Pass

Expected Behavior

Counter page loads successfully.

Steps To Reproduce

Minimal Repro steps (demo attachedBlazorApp1.zip ):

The machine only has 8.0.100-preview.5.23276.4 installed and set DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX environment variable as 2.

1.Create a default Blazor Server application.
2. Install Toolbelt.Blazor.HeadElement nuget package to project.
3. Register service with this code in Program.cs:

builder.Services.AddHeadElementHelper();
  1. Add following code in Counter.razor:
@using Toolbelt.Blazor.HeadElement
<Title>Counter(@currentCount) - Server Side App</Title>
  1. Build the project.
  2. Update the runtime.config file to let the app run on 8.0.100-preview.5.23276.4.
  3. Launch the app.
  4. Click on the Counter menu on left side.

Exceptions (if any)

Counter page loads failed with following error in browser's Console tab or in Visual Studio output window:


fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit 'qdko5bp_9ueaj5mB_AhJtBVGJJX6zSN1Y3lJKSvgZHA'.
      Microsoft.JSInterop.JSException: Could not find 'DotNet.jsCallDispatcher.disposeJSObjectReferenceById' ('jsCallDispatcher' was undefined).
Error: Could not find 'DotNet.jsCallDispatcher.disposeJSObjectReferenceById' ('jsCallDispatcher' was undefined).
    at http://localhost:5142/_framework/blazor.server.js:1:537
    at Array.forEach (<anonymous>)
    at l.findFunction (http://localhost:5142/_framework/blazor.server.js:1:505)
    at b (http://localhost:5142/_framework/blazor.server.js:1:5271)
    at http://localhost:5142/_framework/blazor.server.js:1:3064
    at new Promise (<anonymous>)
    at v.beginInvokeJSFromDotNet (http://localhost:5142/_framework/blazor.server.js:1:3027)
    at Wt._invokeClientMethod (http://localhost:5142/_framework/blazor.server.js:1:76669)
    at Wt._processIncomingData (http://localhost:5142/_framework/blazor.server.js:1:74293)
    at Wt.connection.onreceive (http://localhost:5142/_framework/blazor.server.js:1:68652)
         at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
         at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
         at Microsoft.JSInterop.Implementation.JSObjectReference.DisposeAsync()
         at Toolbelt.Blazor.HeadElement.HeadElementHelperService.EnsureScriptEnabledAsync[T]()
         at Toolbelt.Blazor.HeadElement.HeadElementHelperService.InvokeJSAsync[T](String identifier, Object[] args)
         at Toolbelt.Blazor.HeadElement.HeadElementHelperService.GetDefaultTitleAsync()
         at Toolbelt.Blazor.HeadElement.HeadElementHelperService.GetDefaultsAsync()
         at Toolbelt.Blazor.HeadElement.HeadElementHelperService.ResetIfNeededAsync()
         at Toolbelt.Blazor.HeadElement.HeadElementHelperService.SetTitleAsync(String title)
         at Toolbelt.Blazor.HeadElement.Title.OnParametersSetAsync()
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

.NET Version

8.0.100-preview.5.23276.4

Anything else?

Findings:

After comparing the blazor.server.js file between .NET 7 and .NET 8 Preview.5.23276.4, following code are missing in .NET 8 Preview.5.23276.4:
image

@dotnet-actwx-bot @dotnet/compat

@ghost ghost added the area-blazor Includes: Blazor, Razor Components label May 30, 2023
@Junjun-zhao
Copy link
Member Author

This issue is found in the validation of .NET 8 Preview 5, could you help check and confirm whether this issue is a blocker for .NET 8 Preview 5? Thanks.

@mkArtakMSFT
Copy link
Contributor

Thanks for reporting this. This has been addressed by #48287 but it came late so it will probably be shipped in preview6 only.

@mkArtakMSFT mkArtakMSFT added the bug This issue describes a behavior which is not expected - a bug. label May 30, 2023
@mkArtakMSFT mkArtakMSFT added this to the 8.0-preview6 milestone May 30, 2023
@Junjun-zhao
Copy link
Member Author

Verified this issue and it has been fixed on dotnet-sdk-8.0.100-preview.5.23281.8

@ghost ghost locked as resolved and limited conversation to collaborators Jul 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Projects
None yet
Development

No branches or pull requests

2 participants