{"record":{"id":"6d2443ca88702e6d","repo":"dotnet/runtime","slug":"assemblynametoload-must-be-marked-with-blazorw","errorCode":null,"errorMessage":"${assemblyNameToLoad} must be marked with 'BlazorWebAssemblyLazyLoad' item group in your project file to allow lazy-loading.","messagePattern":"(.+?) must be marked with 'BlazorWebAssemblyLazyLoad' item group in your project file to allow lazy-loading\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mono/browser/runtime/lazyLoading.ts","lineNumber":36,"sourceCode":"        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;\n        }\n    }\n\n    if (dllAsset == null) {\n        throw new Error(`${assemblyNameToLoad} must be marked with 'BlazorWebAssemblyLazyLoad' item group in your project file to allow lazy-loading.`);\n    }\n\n    if (loaderHelpers.loadedAssemblies.includes(dllAsset.name)) {\n        return false;\n    }\n\n    const pdbNameToLoad = assemblyNameWithoutExtension + \".pdb\";\n    let shouldLoadPdb = false;\n    let pdbAsset: (PdbAsset & AssetEntryInternal) | null = null;\n    if (loaderHelpers.config.debugLevel != 0 && loaderHelpers.isDebuggingSupported()) {\n        for (let i = 0; i < lazyAssemblies.length; i++) {\n            if (lazyAssemblies[i].virtualPath === pdbNameToLoad) {\n                shouldLoadPdb = true;\n                pdbAsset = lazyAssemblies[i] as PdbAsset & AssetEntryInternal;\n                pdbAsset.behavior = \"pdb\";\n                break;\n            }\n        }","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/mono/browser/runtime/lazyLoading.ts#L18-L54","documentation":"Thrown by loadLazyAssembly when the requested assembly name does not match any entry in the configured lazyAssembly resources list. It means lazy loading IS configured for the app, but the specific assembly you asked for was not declared as lazy-loadable.","triggerScenarios":"Produced when loadLazyAssembly(assemblyNameToLoad) finds no matching virtualPath (.dll or .wasm) in resources.lazyAssembly. E.g. requesting 'PluginB.dll' when only 'PluginA.dll' is declared.","commonSituations":"The assembly was added to the project but not marked with BlazorWebAssemblyLazyLoad; typo in the assembly name passed to LoadAssembliesAsync; the assembly is already loaded eagerly (so it was never added to the lazy list) but code tries to lazy-load it anyway.","solutions":["Add the specific assembly to <BlazorWebAssemblyLazyLoad Include=\"AssemblyName.dll\" /> in the project.","Verify the name passed to LoadAssembliesAsync exactly matches the declared assembly (case-sensitive, with or without .dll extension is handled, but the base name must match).","Re-publish so blazor.boot.json lists the assembly under lazyAssembly.","If the assembly must be available at startup, do not lazy-load it — load it eagerly instead."],"exampleFix":"<!-- before: missing the specific assembly -->\n<ItemGroup>\n  <BlazorWebAssemblyLazyLoad Include=\"PluginA.dll\" />\n</ItemGroup>\n<!-- code calls LoadAssembliesAsync(new[]{ \"PluginB.dll\" }) -->\n\n<!-- after -->\n<ItemGroup>\n  <BlazorWebAssemblyLazyLoad Include=\"PluginA.dll\" />\n  <BlazorWebAssemblyLazyLoad Include=\"PluginB.dll\" />\n</ItemGroup>","handlingStrategy":"validation","validationCode":"const lazyNames = (config.resources?.lazyAssembly || []).map(a => a.virtualPath);\nconst wanted = 'PluginB.dll';\nif (!lazyNames.includes(wanted)) {\n  // add <BlazorWebAssemblyLazyLoad Include=\"PluginB.dll\" />\n}","typeGuard":"function isLazyLoadable(config: any, assemblyName: string): boolean {\n  const base = assemblyName.replace(/\\.(dll|wasm)$/, '');\n  return (config?.resources?.lazyAssembly || []).some(a =>\n    a.virtualPath === base + '.dll' || a.virtualPath === base + '.wasm');\n}","tryCatchPattern":null,"preventionTips":["Keep the lazy-load ItemGroup and the names passed to LoadAssembliesAsync in sync.","Match names exactly (the base name; .dll/.wasm extension is tolerated).","Republish after editing lazy-load declarations."],"tags":["blazor","lazy-loading","assembly","config"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}