{"record":{"id":"b5d4786ee634e4eb","repo":"dotnet/maui","slug":"xc0101","errorCode":"XC0101","errorMessage":"x:Static: unable to find a public -- or accessible internal -- static field, static property, const or enum value named \"{0}\" in \"{1}\".","messagePattern":"x:Static: unable to find a public -- or accessible internal -- static field, static property, const or enum value named \"(.+?)\" in \"(.+?)\"\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs","lineNumber":31,"sourceCode":"\t\t{\n\t\t\tINode ntype;\n\t\t\tif (!node.Properties.TryGetValue(new XmlName(\"\", \"Member\"), out ntype))\n\t\t\t\tntype = node.CollectionItems[0];\n\t\t\tvar member = ((ValueNode)ntype).Value as string;\n\n\t\t\tif (IsNullOrEmpty(member) || !member.Contains(\".\"))\n\t\t\t\tthrow new BuildException(BuildExceptionCode.XStaticSyntax, node as IXmlLineInfo, null);\n\n\t\t\tvar dotIdx = member.LastIndexOf('.');\n\t\t\tvar typename = member.Substring(0, dotIdx);\n\t\t\tvar membername = member.Substring(dotIdx + 1);\n\n\t\t\tvar typeRef = module.ImportReference(XmlTypeExtensions.GetTypeReference(context.Cache, typename, module, node as BaseNode, expandToExtension: false));\n\t\t\tvar fieldRef = GetFieldReference(context.Cache, typeRef, membername, module);\n\t\t\tvar propertyDef = GetPropertyDefinition(context.Cache, typeRef, membername, module);\n\n\t\t\tif (fieldRef == null && propertyDef == null)\n\t\t\t\tthrow new BuildException(BuildExceptionCode.XStaticResolution, node as IXmlLineInfo, null, membername, typename);\n\n\t\t\tvar fieldDef = fieldRef?.Resolve();\n\t\t\tif (fieldRef != null)\n\t\t\t{\n\t\t\t\tmemberRef = fieldRef.FieldType;\n\t\t\t\tif (!fieldDef.HasConstant)\n\t\t\t\t\treturn new[] { Instruction.Create(OpCodes.Ldsfld, fieldRef) };\n\n\t\t\t\t//Constants can be numbers, Boolean values, strings, or a null reference. (https://msdn.microsoft.com/en-us/library/e6w8fe1b.aspx)\n\t\t\t\tif (TypeRefComparer.Default.Equals(memberRef, module.TypeSystem.Boolean))\n\t\t\t\t\treturn [Instruction.Create(((bool)fieldDef.Constant) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0)];\n\t\t\t\tif (TypeRefComparer.Default.Equals(memberRef, module.TypeSystem.String))\n\t\t\t\t\treturn [Instruction.Create(OpCodes.Ldstr, (string)fieldDef.Constant)];\n\t\t\t\tif (fieldDef.Constant == null)\n\t\t\t\t\treturn [Instruction.Create(OpCodes.Ldnull)];\n\t\t\t\tif (TypeRefComparer.Default.Equals(memberRef, module.TypeSystem.Char))\n\t\t\t\t\treturn [Instruction.Create(OpCodes.Ldc_I4, (char)fieldDef.Constant)];\n\t\t\t\tif (TypeRefComparer.Default.Equals(memberRef, module.TypeSystem.Single))","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs#L13-L49","documentation":"Thrown after the type referenced by x:Static was resolved successfully but no public (or accessible internal) static field, static property, const, or enum value with the given member name was found on it. The compiler looks up both a field and a property via GetFieldReference/GetPropertyDefinition and fails only when both return null.","triggerScenarios":"Member names a private/internal static member with no InternalsVisibleTo; the member was renamed or removed in a newer package version; misspelling the member name; referencing an instance member instead of a static one; referencing a nested type instead of a value.","commonSituations":"Upgrading the Maui/OS package where a constant was renamed (e.g. a Colors key); referencing a static that lives on a different overload/type; using an internal helper from a third-party library without friend-assembly access; typo such as 'FontSizes.Defaultt'.","solutions":["Open the resolved type in your IDE/object browser and confirm the exact static member name and that it is public (or internal with InternalsVisibleTo).","Correct the spelling/casing of the member after the last '.'.","If the member moved between types, update the typeName portion to the type that now declares it.","If it is internal, add [assembly: InternalsVisibleTo(\"YourApp\")] in the declaring assembly or expose a public wrapper.","Pin/upgrade the package to the version whose API surface contains the member."],"exampleFix":"// before\n<Label Text=\"{x:Static sys:Math.Pi}\" />   <!-- typo: Pi -->\n// after\n<Label Text=\"{x:Static sys:Math.PI}\" />","handlingStrategy":"validation","validationCode":"// Verify the static member exists and is accessible before relying on it\nstatic bool HasPublicStaticMember(Type type, string member) =>\n    type.GetMember(member, BindingFlags.Public | BindingFlags.Static)\n        .Any(m => m is FieldInfo { IsLiteral: true } or FieldInfo { IsStatic: true }\n               or PropertyInfo { GetMethod.IsStatic: true });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the package version whose API you author XAML against, and re-validate after upgrades.","For internal members, add InternalsVisibleTo or expose a public alias.","Use IDE 'go to definition' to confirm the exact static member spelling and accessibility."],"tags":["xaml","xamlc","x-static","member-resolution","api-versioning","build-time"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}