{"record":{"id":"107bae75687535f6","repo":"dotnet/maui","slug":"xc0040-107bae","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/EasingTypeConverter.cs","lineNumber":36,"sourceCode":"\t\t\t}\n\n\t\t\tvalue = value?.Trim() ?? \"\";\n\t\t\tvar parts = value.Split('.');\n\t\t\tif (parts.Length == 2 && parts[0] == nameof(Easing))\n\t\t\t\tvalue = parts[parts.Length - 1];\n\n\t\t\tvar assemblyTypeInfo = (\"Microsoft.Maui.Controls\", \"Microsoft.Maui.Controls\", nameof(Easing));\n\n\t\t\tvar module = context.Body.Method.Module;\n\t\t\tvar fieldReference = module.ImportFieldReference(context.Cache, assemblyTypeInfo, value, isStatic: true, caseSensitive: false);\n\n\t\t\tif (fieldReference != null)\n\t\t\t{\n\t\t\t\tyield return Create(Ldsfld, fieldReference);\n\t\t\t\tyield break;\n\t\t\t}\n\n\t\t\tthrow new BuildException(BuildExceptionCode.Conversion, node, null, value, typeof(Easing));\n\t\t}\n\t}\n}","sourceCodeStart":18,"sourceCodeEnd":39,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/CompiledConverters/EasingTypeConverter.cs#L18-L39","documentation":"XC0040 Conversion thrown by EasingTypeConverter when a XAML string does not match any public static field on the Microsoft.Maui.Controls.Easing class. The converter trims the value, optionally strips an 'Easing.' prefix, then resolves the remainder as a static field name (case-insensitive). If no matching static field is found, the build fails.","triggerScenarios":"Assigning an Easing value that is not a known built-in easing function. Examples: Easing=\"Bounce\" (should be BounceIn or BounceOut), Easing=\"ease-in\" (CSS naming), Easing=\"CustomEasing\" (a custom easing field is not supported by the compiled converter — only static fields on the Easing type itself).","commonSituations":"Confusing CSS easing names (ease-in, ease-out) with MAUI Easing names. Using a custom Easing instance defined in code-behind as a property or local variable — the compiled converter can only reference static fields on the Easing type. Misspelling a known easing name.","solutions":["Use one of the built-in static fields: SinIn, SinOut, SinInOut, CubicIn, CubicOut, CubicInOut, BounceIn, BounceOut, SpringIn, SpringOut, Linear, QuadraticIn, QuadraticOut, or QuadraticInOut.","The 'Easing.' prefix is optional — 'CubicIn' and 'Easing.CubicIn' are both accepted.","For custom easing functions, set the Easing property in code-behind instead of XAML, since the compiled converter cannot reference arbitrary fields."],"exampleFix":"<!-- before -->\n<Animation Easing=\"ease-in-out\" />\n\n<!-- after -->\n<Animation Easing=\"SinInOut\" />\n<!-- or -->\n<Animation Easing=\"Easing.SinInOut\" />","handlingStrategy":"validation","validationCode":"// Validate an Easing XAML string against built-in static fields\nstatic readonly HashSet<string> ValidEasings = new(StringComparer.OrdinalIgnoreCase)\n{\n    \"SinIn\",\"SinOut\",\"SinInOut\",\"CubicIn\",\"CubicOut\",\"CubicInOut\",\n    \"BounceIn\",\"BounceOut\",\"SpringIn\",\"SpringOut\",\"Linear\",\n    \"QuadraticIn\",\"QuadraticOut\",\"QuadraticInOut\"\n};\nstatic bool IsValidEasing(string value)\n{\n    if (string.IsNullOrWhiteSpace(value)) return false;\n    var name = value.Trim();\n    if (name.StartsWith(\"Easing.\", StringComparison.OrdinalIgnoreCase))\n        name = name[\"Easing.\".Length..];\n    return ValidEasings.Contains(name);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a reference list of valid Easing field names handy when writing animations in XAML.","Custom easing functions cannot be used from XAML compiled markup — set them in code-behind.","The 'Easing.' prefix is optional but the remainder must exactly match a static field name."],"tags":["xaml","maui","xamlc","type-converter","easing","animation","build-time"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}