{"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/60108ba66eb7d1d12f595480091b4ad80a24b172/src/mono/browser/runtime/lazyLoading.ts#L18-L54","documentation":"Thrown by loadLazyAssembly in lazyLoading.ts when the requested assembly is not present in resources.lazyAssembly (no asset.virtualPath matches assemblyNameToLoad.dll/.wasm). The assembly was not opted into lazy loading via the BlazorWebAssemblyLazyLoad item group, so it is unavailable for on-demand load even though some other assemblies are.","triggerScenarios":"Calling loadLazyAssembly('Plugin.dll') when Plugin.dll is referenced normally (loaded eagerly) but not listed as lazy-loadable; typo in the assembly name passed to the API; the assembly was renamed without updating the caller.","commonSituations":"Forgetting to add the specific assembly to <BlazorWebAssemblyLazyLoad Include=...>; referencing the assembly directly (so it is eagerly loaded) but still trying to lazy-load it; case mismatch in the dll name.","solutions":["Add the exact assembly name to <BlazorWebAssemblyLazyLoad Include=\"Plugin.dll\" /> and rebuild.","Pass the assembly name exactly as it appears in blazor.boot.json (with or without .dll per the API).","If the assembly is already eagerly loaded, do not call the lazy-load API for it."],"exampleFix":"<!-- before: <BlazorWebAssemblyLazyLoad Include=\"Other.dll\" /> -->\n<!-- after: -->\n<ItemGroup>\n  <BlazorWebAssemblyLazyLoad Include=\"Plugin.dll\" />\n</ItemGroup>","handlingStrategy":"validation","validationCode":"// before calling loadLazyAssembly(name)\nconst known = (config.resources?.lazyAssembly ?? []).map(a => a.virtualPath);\nif (!known.includes(name.endsWith('.dll') ? name : name + '.dll'))\n    throw new Error(`${name} is not in BlazorWebAssemblyLazyLoad`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match the exact assembly name (including casing) in both the item group and the API call.","Do not lazy-load assemblies that are already eagerly referenced.","Rebuild after editing the BlazorWebAssemblyLazyLoad list."],"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"}