dotnet/aspnetcore · critical · Error

This browser does not support WebAssembly.

Error message

This browser does not support WebAssembly.

What it means

Thrown by importDotnetJs during Blazor WebAssembly boot when typeof WebAssembly === 'undefined' or WebAssembly.validate is missing. The .NET WebAssembly runtime fundamentally requires native WebAssembly support, so boot aborts immediately.

Source

Thrown at src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts:124

    assertHeapIsNotLocked();
    currentHeapLock = MonoHeapLock.create();
    return currentHeapLock;
  },

  invokeWhenHeapUnlocked: function invokeWhenHeapUnlocked(callback) {
    // This is somewhat like a sync context. If we're not locked, just pass through the call directly.
    if (!currentHeapLock) {
      callback();
    } else {
      currentHeapLock.enqueuePostReleaseAction(callback);
    }
  },
};

async function importDotnetJs(startOptions: Partial<WebAssemblyStartOptions>): Promise<ModuleAPI> {
  const browserSupportsNativeWebAssembly = typeof WebAssembly !== 'undefined' && WebAssembly.validate;
  if (!browserSupportsNativeWebAssembly) {
    throw new Error('This browser does not support WebAssembly.');
  }


  // Allow overriding the URI from which the dotnet.*.js file is loaded
  if (startOptions.loadBootResource) {
    const resourceType: WebAssemblyBootResourceType = 'dotnetjs';
    const customSrc = startOptions.loadBootResource(resourceType, 'dotnet.js', '_framework/dotnet.js', '', 'js-module-dotnet');
    if (typeof (customSrc) === 'string') {
      const absoluteSrc = (new URL(customSrc, document.baseURI)).toString();
      return await import(/* webpackIgnore: true */ absoluteSrc);
    } else if (customSrc) {
      // Since we must load this via a import, it's only valid to supply a URI (and not a Request, say)
      throw new Error(`For a ${resourceType} resource, custom loaders must supply a URI string.`);
    }
  }

  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  // @ts-ignore: This dynamic import is handled at runtime and does not need a type declaration.

View on GitHub (pinned to 294cab2f9b)

Solutions

  1. Require a modern browser (Chrome, Edge, Firefox, Safari) with WebAssembly support.
  2. Update the host WebView/SDK (e.g. WebView2) to a version with WebAssembly enabled.
  3. Show a user-facing fallback page when WebAssembly is unavailable instead of letting boot crash.
  4. If WebAssembly is blocked by enterprise policy/CSP, allow 'wasm-unsafe-eval' / enable WebAssembly in policy.

Example fix

// index.html — guard before Blazor boot
if (typeof WebAssembly === 'undefined') {
  document.body.innerHTML = '<p>This app requires WebAssembly. Please update your browser.</p>';
} else {
  import('./_framework/blazor.webassembly.js');
}
Defensive patterns

Strategy: validation

Validate before calling

// Detect before booting Blazor WASM.
function wasmSupported(): boolean {
  return typeof WebAssembly !== 'undefined' && typeof WebAssembly.validate === 'function';
}
if (!wasmSupported()) { showUnsupportedPage(); } else { import('./_framework/blazor.webassembly.js'); }

Type guard

function supportsWebAssembly(): boolean {
  return typeof WebAssembly !== 'undefined'
    && typeof WebAssembly.validate === 'function';
}

Prevention

When it happens

Trigger: Loading a Blazor WebAssembly app in a browser/WebView that lacks WebAssembly (very old browsers, some locked-down embedded WebViews, or WebAssembly disabled by policy).

Common situations: Old browser versions (pre-2017 engines), enterprise WebView controls with WebAssembly disabled, content-security-policy or enterprise policy stripping WebAssembly, testing in a headless/legacy environment without WASM.

Related errors


AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06). Data as JSON: /api/errors/40dabec704ec79bb. Report an issue: GitHub.