{"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":"exception","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/60108ba66eb7d1d12f595480091b4ad80a24b172/src/native/libs/Common/JavaScript/loader/assets.ts#L253-L289","documentation":"Thrown by fetchLazyAssembly() (src/native/libs/Common/JavaScript/loader/assets.ts:268). When managed code calls AssemblyLoadContext to lazily load an assembly at runtime, the loader looks up loaderConfig.resources.lazyAssembly; if that collection does not exist, no assembly was ever marked lazy-loadable, so it throws and tells you to use the BlazorWebAssemblyLazyLoad item group.","triggerScenarios":"Managed code triggers a lazy assembly load (e.g. NavigationManager for a page whose component assembly is lazy, or an explicit AssemblyLoadContext.Load). fetchLazyAssembly is invoked; resources.lazyAssembly is undefined, so line 270 throws.","commonSituations":"Calling LazyAssemblyLoader.LoadAssembliesAsync without having marked any assembly with BlazorWebAssemblyLazyLoad in the project; removing the item group but keeping the lazy-load call site; a route to a lazy component without registering its assembly as lazy-loadable.","solutions":["Add a <BlazorWebAssemblyLazyLoad Include=\"MyLazyAssembly.dll\" /> item to the Blazor app project for each assembly you load lazily.","If you no longer intend to lazy-load, remove the code path that calls LoadAssembliesAsync instead of leaving it dangling.","Rebuild/re-publish after editing the item group so the boot config includes the lazyAssembly resource list."],"exampleFix":"<!-- before: LoadAssembliesAsync called, no item group -> No assemblies have been marked as lazy-loadable -->\n\n<!-- after: add to the .csproj of the Blazor app -->\n<ItemGroup>\n  <BlazorWebAssemblyLazyLoad Include=\"MyLazyAssembly.dll\" />\n</ItemGroup>","handlingStrategy":"validation","validationCode":"function hasLazyAssemblies(resources: any): boolean {\n  return Array.isArray(resources?.lazyAssembly) && resources.lazyAssembly.length > 0;\n}\nif (!hasLazyAssemblies(loaderConfig.resources)) {\n  // do not call LazyAssemblyLoader.LoadAssembliesAsync, or add the item group\n}","typeGuard":"function hasLazyLoadables(r: any): r is { lazyAssembly: { virtualPath: string }[] } {\n  return Array.isArray(r?.lazyAssembly) && r.lazyAssembly.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Add <BlazorWebAssemblyLazyLoad Include=\"...dll\" /> for every assembly you load lazily.","Re-publish after editing the item group so lazyAssembly is present in the boot config.","Remove dangling LoadAssembliesAsync call sites if lazy loading is no longer used."],"tags":["blazor","lazy-loading","assembly-loading","configuration"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}