{"record":{"id":"67c863721c47dff9","repo":"dotnet/maui","slug":"xc0040-67c863","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/ColumnDefinitionCollectionTypeConverter.cs","lineNumber":41,"sourceCode":"\t\t\t\tyield return Create(Newarr, module.ImportReference(context.Cache, (\"Microsoft.Maui.Controls\", \"Microsoft.Maui.Controls\", \"ColumnDefinition\")));\n\t\t\t\tfor (var i = 0; i < parts.Length; i++)\n\t\t\t\t{\n\t\t\t\t\tyield return Create(Dup);\n\t\t\t\t\tyield return Create(Ldc_I4, i);\n\t\t\t\t\tforeach (var instruction in gridlengthconverter.ConvertFromString(parts[i], context, node))\n\t\t\t\t\t\tyield return instruction;\n\t\t\t\t\tyield return Create(Newobj, module.ImportCtorReference(context.Cache,\n\t\t\t\t\t\t\ttype: (\"Microsoft.Maui.Controls\", \"Microsoft.Maui.Controls\", \"ColumnDefinition\"),\n\t\t\t\t\t\t\tparameterTypes: new[] { (\"Microsoft.Maui\", \"Microsoft.Maui\", \"GridLength\") }));\n\t\t\t\t\tyield return Create(Stelem_Ref);\n\t\t\t\t}\n\t\t\t\tyield return Create(Newobj, module.ImportCtorReference(context.Cache,\n\t\t\t\t\t\ttype: (\"Microsoft.Maui.Controls\", \"Microsoft.Maui.Controls\", \"ColumnDefinitionCollection\"),\n\t\t\t\t\t\tparamCount: 1));\n\t\t\t\tyield break;\n\n\t\t\t}\n\t\t\tthrow new BuildException(BuildExceptionCode.Conversion, node, null, value, typeof(ColumnDefinitionCollection));\n\t\t}\n\t}\n}\n","sourceCodeStart":23,"sourceCodeEnd":45,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/CompiledConverters/ColumnDefinitionCollectionTypeConverter.cs#L23-L45","documentation":"XamlC error XC0040 from ColumnDefinitionCollectionTypeConverter (used by Grid.ColumnDefinitions). The converter only proceeds when the value is non-whitespace; each comma-separated part is then parsed as a GridLength. An empty or whitespace-only value is rejected with XC0040. (A malformed individual part would instead fail inside GridLengthTypeConverter.)","triggerScenarios":"ColumnDefinitions is set to an empty string or whitespace, e.g. ColumnDefinitions=\"\" left in markup.","commonSituations":"An empty attribute left after editing; a binding/placeholder that produced empty; XAML designer inserting a blank value.","solutions":["Provide valid GridLength values separated by commas, e.g. ColumnDefinitions=\"*,2*,100\".","If no explicit columns are needed, remove the ColumnDefinitions attribute."],"exampleFix":"<!-- before -->\n<Grid ColumnDefinitions=\"\">\n  ...\n</Grid>\n\n<!-- after -->\n<Grid ColumnDefinitions=\"*,2*\">\n  ...\n</Grid>","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide explicit GridLength values for ColumnDefinitions or omit the attribute.","Do not leave ColumnDefinitions as an empty string.","Use GridLength syntax ('*', '1*', '100') consistently across all parts."],"tags":["xaml","xamlc","grid","compilation"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}