{"record":{"id":"25d1ef81839d3450","repo":"dotnet/runtime","slug":"no-assemblies-have-been-marked-as-lazy-loadable-u-25d1ef","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":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/native/libs/Common/JavaScript/loader/assets.ts","lineNumber":271,"sourceCode":"            continue;\n        }\n        for (const asset of satelliteResources[culture]) {\n            const assetInternal = asset as AssetEntryInternal;\n            assetInternal.culture = culture;\n            promises.push(fetchAssembly(asset));\n        }\n    }\n    await Promise.all(promises);\n}\n\nfunction lazyAssetFileName(virtualPath: string): string {\n    return virtualPath.substring(virtualPath.lastIndexOf(\"/\") + 1);\n}\n\nexport async function fetchLazyAssembly(assemblyNameToLoad: string): Promise<boolean> {\n    const lazyAssemblies = loaderConfig.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    if (loadedLazyAssemblies.has(assemblyNameWithoutExtension)) {\n        return false;\n    }\n\n    const assemblyNameToLoadDll = assemblyNameWithoutExtension + \".dll\";\n    const assemblyNameToLoadWasm = assemblyNameWithoutExtension + \".wasm\";\n\n    let dllAsset: AssemblyAsset | null = null;\n    for (const asset of lazyAssemblies) {\n        const fileName = lazyAssetFileName(asset.virtualPath);","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/Common/JavaScript/loader/assets.ts#L253-L289","documentation":"fetchLazyAssembly throws this when loaderConfig.resources.lazyAssembly is falsy. Lazy loading (Blazor WebAssembly) requires the project to declare <BlazorWebAssemblyLazyLoad Include=\"...\" /> entries; those populate resources.lazyAssembly in the boot config. Without any, the runtime cannot satisfy a lazy load request.","triggerScenarios":"Application code calls the Blazor lazy-load API (e.g. await JS.Import('MyLazy.dll') / WebAssemblyLoadAssembly) but no <BlazorWebAssemblyLazyLoad> items were declared in the .csproj, so resources.lazyAssembly is undefined.","commonSituations":"Developer added lazy-loading call site but forgot to register the assembly in the project file; the <BlazorWebAssemblyLazyLoad> item was removed during a refactor; running against an old boot config generated before the items were added.","solutions":["Add <BlazorWebAssemblyLazyLoad Include=\"MyLazy\" /> to the .csproj of the Blazor WebAssembly project.","Republish so blazor.boot.json lists the assembly under lazyAssembly.","If you did not intend to lazy load, remove the runtime call that triggers fetchLazyAssembly.","Confirm the published boot config actually contains a lazyAssembly array (inspect blazor.boot.json)."],"exampleFix":"<!-- before -->\n<ItemGroup>\n  <BlazorWebAssemblyLazyLoad Include=\"\" />\n</ItemGroup>\n\n<!-- after -->\n<ItemGroup>\n  <BlazorWebAssemblyLazyLoad Include=\"MyLazy\" />\n  <BlazorWebAssemblyLazyLoad Include=\"PluginLib\" />\n</ItemGroup>","handlingStrategy":"type-guard","validationCode":"if (!Array.isArray(getLoaderConfig().resources?.lazyAssembly) || getLoaderConfig().resources.lazyAssembly.length === 0) {\n  console.warn('Lazy load requested but no <BlazorWebAssemblyLazyLoad> declared — add items to .csproj');\n}","typeGuard":"function hasLazyAssemblies(cfg: any): boolean {\n  return Array.isArray(cfg?.resources?.lazyAssembly) && cfg.resources.lazyAssembly.length > 0;\n}","tryCatchPattern":"try { await loadLazyAssembly(name); }\ncatch (err) {\n  if (/No assemblies have been marked as lazy-loadable/.test(err.message)) {\n    // feature not configured — fall back to eager or skip\n  } else throw err;\n}","preventionTips":["Declare <BlazorWebAssemblyLazyLoad> items before writing lazy-load call sites.","Gate lazy-load UI behind a feature flag that also reflects config availability.","Verify blazor.boot.json contains lazyAssembly before shipping."],"tags":["blazor","lazy-loading","config","assemblies"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}