{"record":{"id":"f37c015c3f5c8d98","repo":"dotnet/maui","slug":"xc0100","errorCode":"XC0100","errorMessage":"Syntax for x:Static is \"[Member=][prefix:]typeName.staticMemberName\".","messagePattern":"Syntax for x:Static is \"\\[Member=\\]\\[prefix:\\]typeName\\.staticMemberName\"\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs","lineNumber":20,"sourceCode":"using System.Xml;\nusing Microsoft.Maui.Controls.Xaml;\nusing Mono.Cecil;\nusing Mono.Cecil.Cil;\nusing static System.String;\n\nnamespace Microsoft.Maui.Controls.Build.Tasks\n{\n\tclass StaticExtension : ICompiledMarkupExtension\n\t{\n\t\tpublic IEnumerable<Instruction> ProvideValue(ElementNode node, ModuleDefinition module, ILContext context, out TypeReference memberRef)\n\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) };","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs#L2-L38","documentation":"Thrown by the XAML compiler (XamlC) when an x:Static markup extension's Member value is empty or lacks the required dot separator. x:Static requires the form '[prefix:]typeName.staticMemberName', so the compiler splits on the last '.' to find the type and the member; if no '.' exists it cannot split and aborts before any resolution is attempted.","triggerScenarios":"Writing <Label Text=\"{x:Static MyField}\" /> (no dot), or <Label Text=\"{x:Static}\" /> (empty Member), or omitting both the Member attribute and any collection item so 'member' resolves to null/empty. Also triggered by a Member like \"{x:Static .}\" whose only dot is the leading character, leaving an empty type segment.","commonSituations":"Forgetting the fully-qualified type prefix and writing only the member name; copy-pasting a C# identifier (e.g. Math.PI written as just PI); XAML authored before the namespace xmlns was declared so the type prefix is dropped; tools that strip namespaces when refactoring.","solutions":["Rewrite the Member value to use the full form 'typeName.staticMemberName', e.g. Member=\"sys:Math.PI\" with xmlns:sys declared.","If omitting Member, place the full dotted expression as the element's first collection item.","Verify the xmlns prefix mapping exists on the root element so the type portion resolves.","Run a XAML lint/schema check that flags x:Static values missing a '.' character before building."],"exampleFix":"// before\n<Label Text=\"{x:Static PI}\" />\n// after\n<Label Text=\"{x:Static sys:Math.PI}\" />\n  (root: xmlns:sys=\"clr-namespace:System;assembly=System.Runtime\")","handlingStrategy":"validation","validationCode":"// Pre-build XAML sanity check for x:Static\nstatic bool IsValidXStaticMember(string member) =>\n    !string.IsNullOrEmpty(member) && member.Contains('.');\n\n// usage during authoring/CI lint:\n// foreach attr ending in 'Member' or x:Static value -> IsValidXStaticMember(value)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always author x:Static as 'prefix:typeName.memberName' and declare the prefix xmlns.","Enable XAML compile-time validation (XamlCompilation=Compile) so errors surface at build, not runtime.","Run a CI XAML lint step that flags x:Static values lacking a '.'."],"tags":["xaml","xamlc","x-static","markup-extension","build-time"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}