{"record":{"id":"54028cddbc4d964e","repo":"unoplatform/uno","slug":"msbuild-property-msbuildprojectfullpath-value-pr","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/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs","lineNumber":69,"sourceCode":"\t\t\tpublic string[] AnalyzerSuppressions { get; set; } = Array.Empty<string>();\n\n\t\t\tinternal void Generate(GeneratorExecutionContext context)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tvar validPlatform = PlatformHelper.IsValidPlatform(context);\n\t\t\t\t\tvar isDesignTime = DesignTimeHelper.IsDesignTime(context);\n\t\t\t\t\tvar isApplication = PlatformHelper.IsApplication(context);\n\n\t\t\t\t\t_ = bool.TryParse(context.GetMSBuildPropertyValue(\"UnoDisableBindableTypeProvidersGeneration\"), out var disableBindableTypeProvidersGeneration);\n\n\t\t\t\t\tif (validPlatform && !isDesignTime && isApplication && !disableBindableTypeProvidersGeneration)\n\t\t\t\t\t{\n\t\t\t\t\t\t_cancellationToken = context.CancellationToken;\n\n\t\t\t\t\t\t_projectFullPath = context.GetMSBuildPropertyValue(\"MSBuildProjectFullPath\");\n\t\t\t\t\t\t_projectDirectory = Path.GetDirectoryName(_projectFullPath)\n\t\t\t\t\t\t\t?? throw new InvalidOperationException($\"MSBuild property MSBuildProjectFullPath value {_projectFullPath} is not valid\");\n\n\t\t\t\t\t\t// Defaults to 'false'\n\t\t\t\t\t\t_ = bool.TryParse(context.GetMSBuildPropertyValue(\"UnoXamlResourcesTrimming\"), out _xamlResourcesTrimming);\n\n\t\t\t\t\t\t_intermediateOutputPath = context.GetMSBuildPropertyValue(\"IntermediateOutputPath\");\n\t\t\t\t\t\t_intermediatePath = Path.Combine(\n\t\t\t\t\t\t\t_projectDirectory,\n\t\t\t\t\t\t\t_intermediateOutputPath\n\t\t\t\t\t\t);\n\t\t\t\t\t\t_assemblyName = context.GetMSBuildPropertyValue(\"AssemblyName\");\n\n\t\t\t\t\t\t_defaultNamespace = context.GetMSBuildPropertyValue(\"RootNamespace\");\n\n\t\t\t\t\t\t_dependencyPropertySymbol = context.Compilation.GetTypeByMetadataName(XamlConstants.Types.DependencyProperty);\n\t\t\t\t\t\t_dependencyObjectSymbol = context.Compilation.GetTypeByMetadataName(XamlConstants.Types.DependencyObject);\n\n\t\t\t\t\t\t_javaObjectSymbol = context.Compilation.GetTypeByMetadataName(\"Java.Lang.Object\");\n\t\t\t\t\t\t_nsObjectSymbol = context.Compilation.GetTypeByMetadataName(\"Foundation.NSObject\");","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs#L51-L87","documentation":"BindableTypeProvidersGenerationTask reads the MSBuildProjectFullPath property to derive the project directory for output. Path.GetDirectoryName returns null only when the path is empty, a drive root, or otherwise has no directory component, which the generator treats as an invalid project path and throws InvalidOperationException. The generator only runs when validPlatform && !isDesignTime && isApplication && !disableBindableTypeProvidersGeneration.","triggerScenarios":"MSBuildProjectFullPath is empty, whitespace, a bare root (e.g. '/'), or unset at the time the generator executes, while all four activation conditions are true.","commonSituations":"Building through a non-standard host or test harness that does not define MSBuildProjectFullPath; a corrupted/empty .csproj; invoking the generator outside a normal MSBuild build.","solutions":["Confirm the build is invoked through MSBuild/dotnet so MSBuildProjectFullPath is populated.","Inspect the .csproj for an empty/invalid <Project> path or a misconfigured SDK import.","If you intentionally drive the generator headless, set the property explicitly: dotnet build -p:MSBuildProjectFullPath=/abs/path/to/Project.csproj."],"exampleFix":"# before: property missing/unset\ndotnet build /some/dir\n# after: ensure MSBuildProjectFullPath resolves, or pass it explicitly\ndotnet build /abs/path/to/Project.csproj","handlingStrategy":"validation","validationCode":"// Assert the MSBuild property resolves before invoking a build that activates this generator\nvar path = Environment.GetEnvironmentVariable(\"MSBuildProjectFullPath\");\nif (string.IsNullOrWhiteSpace(path) || System.IO.Path.GetDirectoryName(path) == null)\n    throw new InvalidOperationException(\"MSBuildProjectFullPath is not set/valid; build via dotnet/MSBuild.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build through dotnet/MSBuild so MSBuildProjectFullPath is populated.","Avoid invoking Uno source generators from bare Roslyn drivers without seeding MSBuild properties."],"tags":["msbuild","source-generator","build-config","project-path"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}