Skip to content

Navigating away while a Web Worker operation is running can sometimes cause an unhandled error in the browser console. #69218

Description

@Vinoth2562000

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

What Happened

In the Blazor WebAssembly standalone and Interactive WebAssembly sample, clicking Run in Worker starts a 5-second worker operation. If you navigate from Counter to Weather before the operation finishes and then return to Counter, an error may appear in the browser console. This issue occurs randomly and is not consistently reproducible.

Expected Behavior

When navigating away, the WebWorkerClient should be disposed or cancelled safely. Any running worker operation should complete, cancel, or fail gracefully without causing unhandled browser or Blazor errors. Returning to the Counter page should create a clean component instance.

Steps To Reproduce

  1. Install .NET SDK 11.0.100-preview.7.26381.103
  2. Clone the sample repository:
    https://github.com/Vinoth2562000/BlazorWebWorkerValidation/tree/main/Standalone_WebAssembly_NET11
  3. Open a terminal and navigate to the BlazorWebWorkerStandalone project folder.
  4. Install the dotnet-serve tool (if it is not already installed):
dotnet tool install --global dotnet-serve
  1. Publish the application:
dotnet publish -c Release
  1. Navigate to the publish output directory:
cd bin\Release\net11.0\publish\wwwroot
  1. Host the published application:
dotnet-serve -S
  1. Open the localhost URL displayed in the terminal.
  2. Open the Counter page.
  3. Click Run in Worker.
  4. Before the 5-second operation completes, navigate to the Weather page.
  5. Navigate back to the Counter page.
  6. Click anywhere on the page and wait for the original worker operation to complete.
  7. Open Browser DevTools → Console and check for unhandled errors.
  8. Repeat the steps multiple times, as the issue occurs intermittently.

Evidence

Error Logs

Published Files

Screenshot

Image

Observed Behavior

Disposing the WebWorkerClient and navigating away while a worker operation is still running can sometimes result in an unhandled browser console error.

Exceptions (if any)

No response

.NET Version

.NET SDK 11.0.100-preview.7.26381.103

Anything else?

No response

Activity

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-blazorIncludes: Blazor, Razor Components

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions