dotnet/runtime · error · Error
No assemblies have been marked as lazy-loadable. Use the…
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 in lazyLoading.ts when loaderHelpers.config.resources.lazyAssembly is null/undefined. Blazor lazy loading requires that assemblies be explicitly opted in via the BlazorWebAssemblyLazyLoad MSBuild item group; without it, no lazy assemblies are listed in the boot resources and the loader has nothing to fetch.
Solutions
- Add the assembly to the BlazorWebAssemblyLazyLoad item group in the .csproj: <BlazorWebAssemblyLazyLoad Include="MyLazyAssembly.dll" />.
- Rebuild so blazor.boot.json includes a lazyAssembly section.
- If you did not intend to lazy-load, remove the call to loadLazyAssembly / lazy-load router config.
Example fix
<!-- before: no lazy items --> <!-- after: in .csproj --> <ItemGroup> <BlazorWebAssemblyLazyLoad Include="MyLazyAssembly.dll" /> </ItemGroup>
Defensive patterns
Strategy: validation
Validate before calling
// before calling loadLazyAssembly
if (!config.resources?.lazyAssembly?.length)
throw new Error('Add <BlazorWebAssemblyLazyLoad Include="..." /> to .csproj first'); Prevention
- Add BlazorWebAssemblyLazyLoad items for every assembly you intend to lazy-load.
- Rebuild after adding items so blazor.boot.json includes a lazyAssembly section.
- Do not call the lazy-load API unless at least one assembly is opted in.
When it happens
Trigger: Calling JSRuntime's lazy-load API (or OnNavigateAsync with RouterConfig with lazy assemblies) in a Blazor WebAssembly project that has not added any <BlazorWebAssemblyLazyLoad Include="..." /> items.
Common situations: Adopting lazy loading but forgetting the MSBuild item; renaming an assembly so the Include no longer matches; deploying with a stale blazor.boot.json that lacks a lazyAssembly section.
Related errors
- must be marked with 'BlazorWebAssemblyLazyLoad' item group…
- must be marked with 'BlazorWebAssemblyLazyLoad' item group…
- No assemblies have been marked as lazy-loadable. Use the…
- Loader configuration error: 'resources.coreAssembly' is…
- method instrumentation is not enabled, please enable it…
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/fff0a6822b83d1a6.
Report an issue: GitHub.
Appendix: 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 60108ba66e)