dotnet/runtime · error · Error

No assemblies have been marked as lazy-loadable. Use the 'Bl

Error message

No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly.

What it means

Thrown by loadLazyAssembly when loaderHelpers.config.resources.lazyAssembly is falsy. It means no assemblies were configured as lazy-loadable in the project, so there is nothing for the lazy loader to look up. This is a Blazor WebAssembly lazy-loading contract error.

Source

Thrown at src/mono/browser/runtime/lazyLoading.ts:13

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

import { loaderHelpers } from "./globals";
import { load_lazy_assembly } from "./managed-exports";
import { type AssemblyAsset, type PdbAsset } from "./types";
import { type AssetEntryInternal } from "./types/internal";

export async function loadLazyAssembly (assemblyNameToLoad: string): Promise<boolean> {
    const resources = loaderHelpers.config.resources!;
    const lazyAssemblies = resources.lazyAssembly;
    if (!lazyAssemblies) {
        throw new Error("No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly.");
    }

    let assemblyNameWithoutExtension = assemblyNameToLoad;
    if (assemblyNameToLoad.endsWith(".dll"))
        assemblyNameWithoutExtension = assemblyNameToLoad.substring(0, assemblyNameToLoad.length - 4);
    else if (assemblyNameToLoad.endsWith(".wasm"))
        assemblyNameWithoutExtension = assemblyNameToLoad.substring(0, assemblyNameToLoad.length - 5);

    const assemblyNameToLoadDll = assemblyNameWithoutExtension + ".dll";
    const assemblyNameToLoadWasm = assemblyNameWithoutExtension + ".wasm";

    let dllAsset: (AssemblyAsset & AssetEntryInternal) | null = null;
    for (let i = 0; i < lazyAssemblies.length; i++) {
        const asset = lazyAssemblies[i];
        if (asset.virtualPath === assemblyNameToLoadDll || asset.virtualPath === assemblyNameToLoadWasm) {
            dllAsset = asset as AssemblyAsset & AssetEntryInternal;
            dllAsset.behavior = "assembly";
            break;

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Add <BlazorWebAssemblyLazyLoad Include="YourAssembly.dll" /> to the project's <ItemGroup> for each assembly you intend to load lazily.
  2. Re-publish the app so blazor.boot.json includes the lazyAssembly resources.
  3. Guard the LoadAssembliesAsync call so it only runs when lazy loading is actually configured.

Example fix

<!-- before: calling lazy load with no configuration -->
<!-- <ItemGroup> (nothing) </ItemGroup> -->

<!-- after -->
<ItemGroup>
  <BlazorWebAssemblyLazyLoad Include="MyPlugin.dll" />
</ItemGroup>
Defensive patterns

Strategy: validation

Validate before calling

// Check the boot config before calling lazy load
const lazy = dotnet.getConfig?.().resources?.lazyAssembly;
if (!lazy || lazy.length === 0) {
  // add <BlazorWebAssemblyLazyLoad> or skip the call
}

Type guard

function hasLazyAssemblies(config: any): boolean {
  return Array.isArray(config?.resources?.lazyAssembly) && config.resources.lazyAssembly.length > 0;
}

Prevention

When it happens

Trigger: Produced when calling loadLazyAssembly (e.g. via Blazor's LazyAssemblyLoader or the underlying API) on an app whose boot config has no 'lazyAssembly' resource array — i.e. the project did not declare any <BlazorWebAssemblyLazyLoad> items.

Common situations: Calling LazyAssemblyLoader.LoadAssembliesAsync in a project that forgot to add the BlazorWebAssemblyLazyLoad item group; deploying the app without re-publishing after adding lazy-load references; the boot config (blazor.boot.json) lacks the lazyAssembly section.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/fff0a6822b83d1a6. Report an issue: GitHub.