{"record":{"id":"0e1db63639250fe2","repo":"dotnet/maui","slug":"xc0061","errorCode":"XC0061","errorMessage":"Error while parsing markup expression.","messagePattern":"Error while parsing markup expression\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Build.Tasks/ExpandMarkupsVisitor.cs","lineNumber":91,"sourceCode":"\t\t\t\tif (kvp.Value != node)\n\t\t\t\t\tcontinue;\n\t\t\t\tname = kvp.Key;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tstatic INode ParseExpression(ref string expression, ILContext context, IXmlNamespaceResolver nsResolver,\n\t\t\tIXmlLineInfo xmlLineInfo)\n\t\t{\n\t\t\tif (expression.StartsWith(\"{}\", StringComparison.Ordinal))\n\t\t\t\treturn new ValueNode(expression.Substring(2), null);\n\n\t\t\tif (expression[expression.Length - 1] != '}')\n\t\t\t\tthrow new BuildException(BuildExceptionCode.MarkupNotClosed, xmlLineInfo, null);\n\n\t\t\tif (!MarkupExpressionParser.MatchMarkup(out var match, expression, out var len))\n\t\t\t\tthrow new BuildException(BuildExceptionCode.MarkupParsingFailed, xmlLineInfo, null);\n\t\t\texpression = expression.Substring(len).TrimStart();\n\t\t\tif (expression.Length == 0)\n\t\t\t\tthrow new BuildException(BuildExceptionCode.MarkupNotClosed, xmlLineInfo, null);\n\n\t\t\tvar provider = new XamlServiceProvider(null, null);\n\t\t\tprovider.Add(typeof(ILContextProvider), new ILContextProvider(context));\n\t\t\tprovider.Add(typeof(IXmlNamespaceResolver), nsResolver);\n\t\t\tprovider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(xmlLineInfo));\n\n\t\t\treturn new MarkupExpansionParser().Parse(match, ref expression, provider);\n\t\t}\n\n\t\tclass ILContextProvider(ILContext context)\n\t\t{\n\t\t\tpublic ILContext Context { get; } = context;\n\t\t}\n\n\t\tclass MarkupExpansionParser : MarkupExpressionParser, IExpressionParser<INode>","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/ExpandMarkupsVisitor.cs#L73-L109","documentation":"Thrown when MarkupExpressionParser.MatchMarkup cannot recognize the leading token of a markup expression as a valid markup extension name. After confirming the closing brace, the compiler tries to match the extension identifier; failure means the syntax does not start with a known markup name pattern.","triggerScenarios":"An expression that begins with '{' but the next token is not a valid markup name (e.g. '{123}' or '{ }'); a malformed/empty markup name; stray '{' used as literal text without the '{}' escape prefix.","commonSituations":"Using '{' literally in text without escaping with '{}'; whitespace or operators right after '{'; tooling that injects a brace for interpolation.","solutions":["Escape literal braces with the '{} ' prefix, e.g. Content=\"{}{not a binding}\".","If intending a markup extension, start with a valid name: '{Binding ...}', '{x:Static ...}', etc.","Remove stray '{' characters from attribute values."],"exampleFix":"// before\n<Label Text=\"{some literal text}\" />\n// after\n<Label Text=\"{}{some literal text}\" />","handlingStrategy":"validation","validationCode":"// Lint: a '{' must be followed by a valid markup name or escaped with '{}'\nstatic readonly Regex MarkupName = new(@\"^\\{([A-Za-z_][\\w\\.]*:?[A-Za-z_][\\w\\.]*)\");\nstatic bool MarkupStartsValid(string value) =>\n    value.StartsWith(\"{}\") || MarkupName.IsMatch(value) || !value.StartsWith(\"{\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Escape literal braces with the '{} ' prefix.","Begin real markup with a known extension name like Binding or x:Static."],"tags":["xaml","xamlc","markup-extension","syntax","escaping","build-time"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}