{"record":{"id":"cac296b62d4ef5db","repo":"unoplatform/uno","slug":"the-configuration-property-must-be-provided-cac296","errorCode":null,"errorMessage":"The configuration property must be provided","messagePattern":"The configuration property must be provided","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs","lineNumber":191,"sourceCode":"\n\t\tpublic XamlCodeGeneration(GeneratorExecutionContext context)\n\t\t{\n\t\t\t// To easily debug XAML code generation:\n\t\t\t// Add <UnoUISourceGeneratorDebuggerBreak>True</UnoUISourceGeneratorDebuggerBreak> to your project\n\n\t\t\tif (!Helpers.DesignTimeHelper.IsDesignTime(context)\n\t\t\t\t&& (context.GetMSBuildPropertyValue(\"UnoUISourceGeneratorDebuggerBreak\")?.Equals(\"True\", StringComparison.OrdinalIgnoreCase) ?? false))\n\t\t\t{\n\t\t\t\tDebugger.Launch();\n\t\t\t}\n\n\t\t\t_generatorContext = context;\n\t\t\tInitTelemetry(context);\n\n\t\t\t_metadataHelper = new RoslynMetadataHelper(context);\n\n\t\t\t_configuration = context.GetMSBuildPropertyValue(\"Configuration\")\n\t\t\t\t?? throw new InvalidOperationException(\"The configuration property must be provided\");\n\n\t\t\t_isDebug = string.Equals(_configuration, \"Debug\", StringComparison.OrdinalIgnoreCase);\n\n\t\t\t_projectFullPath = context.GetMSBuildPropertyValue(\"MSBuildProjectFullPath\");\n\t\t\t_projectDirectory = Path.GetDirectoryName(_projectFullPath)\n\t\t\t\t?? throw new InvalidOperationException($\"MSBuild property MSBuildProjectFullPath value {_projectFullPath} is not valid\");\n\n\t\t\tvar pageItems = GetWinUIItems(\"Page\").Concat(GetWinUIItems(\"UnoPage\"));\n\t\t\tvar applicationDefinitionItems = GetWinUIItems(\"ApplicationDefinition\").Concat(GetWinUIItems(\"UnoApplicationDefinition\"));\n\n\t\t\t_xamlSources = pageItems\n\t\t\t\t.Except(applicationDefinitionItems, MSBuildItem.IdentityComparer)\n\t\t\t\t.Concat(applicationDefinitionItems)\n\t\t\t\t.Distinct(MSBuildItem.IdentityComparer)\n\t\t\t\t.Select(item => new XamlSource(item, GetSourceLink(item)))\n\t\t\t\t.ToArray();\n\n\t\t\t_excludeXamlNamespaces = context.GetMSBuildPropertyValue(\"ExcludeXamlNamespacesProperty\");","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs#L173-L209","documentation":"Thrown during XamlCodeGeneration constructor initialization when the MSBuild property 'Configuration' is null. The source generator reads this property via context.GetMSBuildPropertyValue(\"Configuration\") and throws an InvalidOperationException if it is absent.","triggerScenarios":"The XAML source generator is invoked by a build host or tool that does not set the 'Configuration' MSBuild property — e.g. a custom Roslyn-based analysis tool, an IDE integration that bypasses MSBuild, or a misconfigured targets file.","commonSituations":"Building with a custom MSBuild script that does not set Configuration; running the generator in a unit test harness that does not provide MSBuild properties; a corrupted or partial .props/.targets chain that drops Configuration.","solutions":["Ensure the build is invoked through a standard MSBuild or dotnet build command that sets Configuration (e.g. dotnet build -c Debug).","If invoking the generator programmatically, set Configuration in the generator's MSBuild property provider.","Check that no custom .targets file is clearing or overriding Configuration to null."],"exampleFix":"<!-- In a custom .targets or build script, ensure Configuration is set: -->\n<PropertyGroup>\n  <Configuration>Debug</Configuration>\n</PropertyGroup>","handlingStrategy":"validation","validationCode":"<!-- Ensure Configuration is set in build scripts -->\n<Project>\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n  </PropertyGroup>\n</Project>\n<!-- Or always pass -c/--configuration: dotnet build -c Debug -->","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always invoke builds with an explicit Configuration (dotnet build -c Debug).","Add a default for Configuration in Directory.Build.props.","If invoking the generator programmatically, provide all required MSBuild properties."],"tags":["build-config","msbuild","source-generator","configuration"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}