{"record":{"id":"3b37c349c4ff4bcb","repo":"dotnet/aspnetcore","slug":"assembly-must-be-defined-when-using-a-descriptor","errorCode":null,"errorMessage":"assembly must be defined when using a descriptor.","messagePattern":"assembly must be defined when using a descriptor\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts","lineNumber":270,"sourceCode":"\n  if (!descriptor) {\n    throw new Error('descriptor must be defined when using a descriptor.');\n  }\n\n  if (sequence === undefined) {\n    throw new Error('sequence must be defined when using a descriptor.');\n  }\n\n  if (!Number.isInteger(sequence)) {\n    throw new Error(`Error parsing the sequence '${sequence}' for component '${JSON.stringify(payload)}'`);\n  }\n}\n\nfunction validateWebAssemblyComponentPayload(payload: WebAssemblyMarkerData) {\n  const { assembly, typeName } = payload;\n\n  if (!assembly) {\n    throw new Error('assembly must be defined when using a descriptor.');\n  }\n\n  if (!typeName) {\n    throw new Error('typeName must be defined when using a descriptor.');\n  }\n\n  // Parameter definitions and values come Base64 encoded from the server, since they contain random data and can make the\n  // comment invalid. We could unencode them in .NET Code, but that would be slower to do and we can leverage the fact that\n  // JS provides a native function that will be much faster and that we are doing this work while we are fetching\n  // blazor.boot.json\n  payload.parameterDefinitions = payload.parameterDefinitions && atob(payload.parameterDefinitions);\n  payload.parameterValues = payload.parameterValues && atob(payload.parameterValues);\n}\n\nfunction validateEndComponentPayload(json: string, prerenderId: string): void {\n  const payload = JSON.parse(json) as ComponentEndMarker;\n  if (Object.keys(payload).length !== 1) {\n    throw new Error(`Invalid end of component comment: '${json}'`);","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts#L252-L288","documentation":"Thrown by validateWebAssemblyComponentPayload (ComponentDescriptorDiscovery.ts:270) when a webassembly/auto marker lacks a truthy 'assembly' field. The assembly name identifies the .NET DLL containing the component type; without it the WebAssembly runtime cannot resolve the component.","triggerScenarios":"A webassembly/auto component marker whose JSON omits 'assembly'; marker emitted by code that did not set the assembly name; corrupted/transformed marker JSON.","commonSituations":"Custom rendering of WebAssembly root components missing the assembly name; version mismatch; middleware rewriting marker JSON; marker truncated by size limits.","solutions":["Verify the raw marker JSON contains a non-empty 'assembly' (the DLL name without path).","Use the framework's MapComponentToWebAssembly / IComponentRenderMode APIs to emit markers.","Match client and server framework versions.","Remove JSON-rewriting middleware on Blazor responses."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function hasAssembly(payload: any): boolean {\n  return typeof payload?.assembly === 'string' && payload.assembly.length > 0;\n}","typeGuard":"function isWebAssemblyMarkerData(payload: any): payload is { assembly: string; typeName: string } {\n  return typeof payload?.assembly === 'string' && payload.assembly.length > 0\n    && typeof payload?.typeName === 'string' && payload.typeName.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Use MapComponentToWebAssembly / framework registration APIs.","Match framework versions.","Avoid rewriting marker JSON in middleware."],"tags":["blazor","webassembly","markers","serialization","validation"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}