{"record":{"id":"1c4c861acb4f573e","repo":"dotnet/maui","slug":"xc0040-1c4c86","errorCode":"XC0040","errorMessage":"Cannot convert value \"{0}\" to \"{1}\".","messagePattern":"Cannot convert value \"(.+?)\" to \"(.+?)\"\\.","errorType":"error_code","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Build.Tasks/CompiledConverters/PointTypeConverter.cs","lineNumber":23,"sourceCode":"using Mono.Cecil;\nusing Mono.Cecil.Cil;\n\nnamespace Microsoft.Maui.Controls.XamlC;\n\nclass PointTypeConverter : ICompiledTypeConverter\n{\n\tpublic IEnumerable<Instruction> ConvertFromString(string value, ILContext context, BaseNode node)\n\t{\n\t\tvar module = context.Body.Method.Module;\n\t\tif (!string.IsNullOrEmpty(value) && Point.TryParse(value.Trim(), out var point))\n\t\t{\n\t\t\tforeach (var instruction in CreatePoint(context, module, point))\n\t\t\t{\n\t\t\t\tyield return instruction;\n\t\t\t}\n\t\t\tyield break;\n\t\t}\n\t\tthrow new BuildException(BuildExceptionCode.Conversion, node, null, value, typeof(Point));\n\t}\n\n\tpublic IEnumerable<Instruction> CreatePoint(ILContext context, ModuleDefinition module, Point point)\n\t{\n\t\tyield return Instruction.Create(OpCodes.Ldc_R8, point.X);\n\t\tyield return Instruction.Create(OpCodes.Ldc_R8, point.Y);\n\t\tyield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.Cache, (\"Microsoft.Maui.Graphics\", \"Microsoft.Maui.Graphics\", \"Point\"), parameterTypes: new[] {\n\t\t\t\t\t(\"mscorlib\", \"System\", \"Double\"),\n\t\t\t\t\t(\"mscorlib\", \"System\", \"Double\")}));\n\t}\n}\n","sourceCodeStart":5,"sourceCodeEnd":35,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/CompiledConverters/PointTypeConverter.cs#L5-L35","documentation":"XC0040 Conversion thrown by PointTypeConverter when a XAML string cannot be parsed into a Microsoft.Maui.Graphics.Point. The converter uses Point.TryParse on the trimmed value. If the value is null/empty or Point.TryParse fails (expecting 'x,y' format), the build-time exception fires.","triggerScenarios":"Setting a Point-typed property (e.g. AnchorX/AnchorY adjacent pairs, or a translation point) to a malformed coordinate string. Point.TryParse expects a comma or space-separated pair of doubles like '10,20' or '10 20'. A single number, three numbers, or non-numeric text fails.","commonSituations":"Providing only one coordinate instead of two. Using semicolons or other delimiters. Providing a non-numeric value.","solutions":["Provide exactly two comma-separated invariant-culture doubles, e.g. '10,20'.","Ensure both coordinates are valid numbers with no extra delimiters or text.","Check for trailing commas, spaces inside numbers, or locale-specific decimal issues."],"exampleFix":"<!-- before -->\n<VisualElement.AnchorPoint>10</VisualElement.AnchorPoint>\n\n<!-- after -->\n<VisualElement.AnchorPoint>0.5,0.5</VisualElement.AnchorPoint>","handlingStrategy":"validation","validationCode":"// Validate a Point XAML string before building\nstatic bool IsValidPoint(string value)\n    => !string.IsNullOrWhiteSpace(value)\n       && Point.TryParse(value.Trim(), out _);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point expects 'x,y' format with two comma-separated doubles.","Point.TryParse also accepts space-separated values in some overloads — stick to commas for clarity.","Provide both coordinates — a single number is not a valid Point."],"tags":["xaml","maui","xamlc","type-converter","point","graphics","build-time"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}