{"record":{"id":"4425f3902765086b","repo":"unoplatform/uno","slug":"msbuild-property-msbuildprojectfullpath-value-pr-4425f3","errorCode":null,"errorMessage":"MSBuild property MSBuildProjectFullPath value {_projectFullPath} is not valid","messagePattern":"MSBuild property MSBuildProjectFullPath value (.+?) is not valid","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs","lineNumber":197,"sourceCode":"\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\");\n\n\t\t\t_includeXamlNamespaces = context.GetMSBuildPropertyValue(\"IncludeXamlNamespacesProperty\");\n\n\t\t\t_analyzerSuppressions = context.GetMSBuildPropertyValue(\"XamlGeneratorAnalyzerSuppressionsProperty\").Split(_commaArray, StringSplitOptions.RemoveEmptyEntries);\n\n\t\t\t_resourceFiles = context.GetMSBuildItemsWithAdditionalFiles(\"PRIResource\").ToArray();","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs#L179-L215","documentation":"Thrown during XamlCodeGeneration initialization when Path.GetDirectoryName returns null for the value of the 'MSBuildProjectFullPath' MSBuild property. GetDirectoryName returns null when the input is null, empty, or a root path without a directory component.","triggerScenarios":"The MSBuildProjectFullPath property is null, empty, or set to an invalid/root-only value during source generation.","commonSituations":"A custom build host or test harness does not provide MSBuildProjectFullPath; the property was overridden to an invalid value; the project file path contains unusual characters that confuse path resolution.","solutions":["Ensure the build is invoked through a standard MSBuild/dotnet build pipeline that sets MSBuildProjectFullPath to the full project file path.","If running the generator programmatically, populate MSBuildProjectFullPath with a valid absolute path to the .csproj file.","Check for any custom .targets that might be overriding or clearing MSBuildProjectFullPath."],"exampleFix":"// In a test harness, provide the property:\ngeneratorContext.SetMSBuildPropertyValue(\"MSBuildProjectFullPath\", @\"C:\\Projects\\MyApp\\MyApp.csproj\");","handlingStrategy":"validation","validationCode":"// Ensure MSBuildProjectFullPath is valid when invoking the generator:\n// var path = context.GetMSBuildPropertyValue(\"MSBuildProjectFullPath\");\n// if (string.IsNullOrWhiteSpace(path) || !Path.IsPathRooted(path))\n//     throw new ArgumentException(\"MSBuildProjectFullPath must be a valid absolute path\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build through standard MSBuild/dotnet build which sets MSBuildProjectFullPath.","In test harnesses, provide a valid absolute project path.","Do not override MSBuildProjectFullPath in custom targets."],"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"}