{"record":{"id":"447f861e1a135504","repo":"dotnet/aspnetcore","slug":"the-property-identifier-is-not-defined-or-is","errorCode":null,"errorMessage":"The property '${identifier}' is not defined or is not readable.","messagePattern":"The property '(.+?)' is not defined or is not readable\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/JSInterop/Microsoft.JSInterop.JS/src/src/Microsoft.JSInterop.ts","lineNumber":641,"sourceCode":"      switch (callType) {\n      case JSCallType.FunctionCall:\n          const func = parent[memberName];\n          if (func instanceof Function) {\n              return func.bind(parent);\n          }\n          throw new Error(`The value '${identifier}' is not a function.`);\n\n      case JSCallType.ConstructorCall:\n          const ctor = parent[memberName];\n          if (ctor instanceof Function) {\n              const bound = ctor.bind(parent);\n              return (...args: any[]) => new bound(...args);\n          }\n          throw new Error(`The value '${identifier}' is not a function.`);\n\n      case JSCallType.GetValue:\n          if (!isReadableProperty(parent, memberName)) {\n              throw new Error(`The property '${identifier}' is not defined or is not readable.`);\n          }\n          return () => parent[memberName];\n      case JSCallType.SetValue:\n          if (!isWritableProperty(parent, memberName)) {\n              throw new Error(`The property '${identifier}' is not writable.`);\n          }\n          return (...args: any[]) => parent[memberName] = args[0];\n      }\n  }\n\n  function isReadableProperty(obj: any, propName: string) {\n      // Return false for missing property.\n      if (!(propName in obj)) {\n          return false;\n      }\n\n      // If the property is present we examine its descriptor, potentially needing to walk up the prototype chain.\n      while (obj !== undefined) {","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/src/JSInterop/Microsoft.JSInterop.JS/src/src/Microsoft.JSInterop.ts#L623-L659","documentation":"Thrown by wrapJSCallAsFunction() in the GetValue case when isReadableProperty() returns false for the named member. A GetValue operation (.NET reading a property/value via interop) requires the property to exist and either be a data property or have a getter. Missing properties, non-function getters, or absent members all trigger this.","triggerScenarios":".NET calls JS.InvokeAsync<T>('myObj.missingProp') to read a value, but missingProp is not present on myObj or its prototype chain. Also when the property exists only as a setter (write-only) or has a non-function getter descriptor.","commonSituations":"Typo in the property name; property renamed in a JS library version; conditional property that isn't initialized yet at call time; accessing a property defined only with a setter.","solutions":["Confirm the property exists: 'missingProp' in window.myObj and Object.getOwnPropertyDescriptor(window.myObj, 'missingProp').","Fix the identifier spelling / update to the new API name.","Ensure any lazy-initialized properties are set before the interop read."],"exampleFix":"// before (C#)\nvar v = await JS.InvokeAsync<string>(\"myObj.titel\"); // typo\n\n// after\nvar v = await JS.InvokeAsync<string>(\"myObj.title\");","handlingStrategy":"validation","validationCode":"function isReadable(obj, prop) { if (!(prop in obj)) return false; let o = obj; while (o) { const d = Object.getOwnPropertyDescriptor(o, prop); if (d) return d.hasOwnProperty('value') || (typeof d.get === 'function'); o = Object.getPrototypeOf(o); } return false; }","typeGuard":"function isReadableMember(obj: any, prop: string): boolean { if (!(prop in obj)) return false; let o: any = obj; while (o) { const d = Object.getOwnPropertyDescriptor(o, prop); if (d) return d.hasOwnProperty('value') || typeof d.get === 'function'; o = Object.getPrototypeOf(o); } return false; }","tryCatchPattern":"try { var v = await JS.InvokeAsync<string>(\"myObj.title\"); } catch (JSException e) when (e.Message.Contains(\"is not defined or is not readable\")) { /* property missing/typo; fix identifier */ }","preventionTips":["Verify the property exists and is readable with 'prop' in obj and a descriptor check.","Initialize properties before interop reads them (avoid lazy-init race).","Re-check identifier spelling after JS library upgrades."],"tags":["js-interop","blazor","identifier","property","interop"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}