{"record":{"id":"fff0a6822b83d1a6","repo":"dotnet/runtime","slug":"no-assemblies-have-been-marked-as-lazy-loadable-u","errorCode":null,"errorMessage":"No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly.","messagePattern":"No assemblies have been marked as lazy-loadable\\. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mono/browser/runtime/lazyLoading.ts","lineNumber":13,"sourceCode":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n\nimport { loaderHelpers } from \"./globals\";\nimport { load_lazy_assembly } from \"./managed-exports\";\nimport { type AssemblyAsset, type PdbAsset } from \"./types\";\nimport { type AssetEntryInternal } from \"./types/internal\";\n\nexport async function loadLazyAssembly (assemblyNameToLoad: string): Promise<boolean> {\n    const resources = loaderHelpers.config.resources!;\n    const lazyAssemblies = resources.lazyAssembly;\n    if (!lazyAssemblies) {\n        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.\");\n    }\n\n    let assemblyNameWithoutExtension = assemblyNameToLoad;\n    if (assemblyNameToLoad.endsWith(\".dll\"))\n        assemblyNameWithoutExtension = assemblyNameToLoad.substring(0, assemblyNameToLoad.length - 4);\n    else if (assemblyNameToLoad.endsWith(\".wasm\"))\n        assemblyNameWithoutExtension = assemblyNameToLoad.substring(0, assemblyNameToLoad.length - 5);\n\n    const assemblyNameToLoadDll = assemblyNameWithoutExtension + \".dll\";\n    const assemblyNameToLoadWasm = assemblyNameWithoutExtension + \".wasm\";\n\n    let dllAsset: (AssemblyAsset & AssetEntryInternal) | null = null;\n    for (let i = 0; i < lazyAssemblies.length; i++) {\n        const asset = lazyAssemblies[i];\n        if (asset.virtualPath === assemblyNameToLoadDll || asset.virtualPath === assemblyNameToLoadWasm) {\n            dllAsset = asset as AssemblyAsset & AssetEntryInternal;\n            dllAsset.behavior = \"assembly\";\n            break;","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/mono/browser/runtime/lazyLoading.ts#L1-L31","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"<!-- before: no lazy items -->\n<!-- after: in .csproj -->\n<ItemGroup>\n  <BlazorWebAssemblyLazyLoad Include=\"MyLazyAssembly.dll\" />\n</ItemGroup>","handlingStrategy":"validation","validationCode":"// before calling loadLazyAssembly\nif (!config.resources?.lazyAssembly?.length)\n    throw new Error('Add <BlazorWebAssemblyLazyLoad Include=\"...\" /> to .csproj first');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["blazor","lazy-loading","msbuild","configuration"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}