{"record":{"id":"0b09c85678a04155","repo":"unoplatform/uno","slug":"the-configuration-property-must-be-provided","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/NativeCtor/NativeCtorsGenerator.cs","lineNumber":55,"sourceCode":"\t\t\tprivate readonly INamedTypeSymbol? _jniHandleOwnershipSymbol;\n\t\t\tprivate readonly INamedTypeSymbol?[] _javaCtorParams;\n\t\t\tprivate readonly string _configuration;\n\t\t\tprivate readonly bool _isDebug;\n\t\t\tprivate readonly bool _isHotReloadEnabled;\n\n\t\t\tpublic SerializationMethodsGenerator(GeneratorExecutionContext context)\n\t\t\t{\n\t\t\t\t_context = context;\n\n\t\t\t\t_iosViewSymbol = context.Compilation.GetTypeByMetadataName(\"UIKit.UIView\");\n\t\t\t\t_objcNativeHandleSymbol = context.Compilation.GetTypeByMetadataName(\"ObjCRuntime.NativeHandle\");\n\t\t\t\t_androidViewSymbol = context.Compilation.GetTypeByMetadataName(\"Android.Views.View\");\n\t\t\t\t_intPtrSymbol = context.Compilation.GetTypeByMetadataName(\"System.IntPtr\");\n\t\t\t\t_jniHandleOwnershipSymbol = context.Compilation.GetTypeByMetadataName(\"Android.Runtime.JniHandleOwnership\");\n\t\t\t\t_javaCtorParams = new[] { _intPtrSymbol, _jniHandleOwnershipSymbol };\n\n\t\t\t\t_configuration = context.GetMSBuildPropertyValue(\"Configuration\")\n\t\t\t\t\t?? throw new InvalidOperationException(\"The configuration property must be provided\");\n\n\t\t\t\t_isDebug = string.Equals(_configuration, \"Debug\", StringComparison.OrdinalIgnoreCase);\n\n\t\t\t\tif (bool.TryParse(context.GetMSBuildPropertyValue(\"UnoForceHotReloadCodeGen\"), out var isHotReloadEnabled))\n\t\t\t\t{\n\t\t\t\t\t_isHotReloadEnabled = isHotReloadEnabled;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t_isHotReloadEnabled = _isDebug;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic override void VisitNamedType(INamedTypeSymbol type)\n\t\t\t{\n\t\t\t\t_context.CancellationToken.ThrowIfCancellationRequested();\n\n\t\t\t\tforeach (var t in type.GetTypeMembers())","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/NativeCtor/NativeCtorsGenerator.cs#L37-L73","documentation":"The NativeCtors generator reads the MSBuild 'Configuration' property (Debug/Release) to decide hot-reload codegen. GetMSBuildPropertyValue returns null when the property is unset, which the generator treats as invalid and throws InvalidOperationException. MSBuild normally defines Configuration, so a null usually indicates the generator ran outside a normal build.","triggerScenarios":"The source generator executes in a context where the Configuration MSBuild property is not set (null), e.g. driven directly by a Roslyn driver or a test harness that did not seed global properties.","commonSituations":"Unit-testing the generator with a bare CSharpGeneratorDriver; a stripped custom build host; an MSBuild invocation that cleared Configuration.","solutions":["Build through dotnet/MSBuild which always sets Configuration (Debug by default).","If driving the generator programmatically, pass Configuration via generatorOptions/MSBuildProperties or AnalyzerConfigOptions.","Pass it explicitly on the command line: dotnet build -p:Configuration=Debug."],"exampleFix":"# before\ndotnet build # Configuration unset by custom host\n# after\ndotnet build -p:Configuration=Debug","handlingStrategy":"validation","validationCode":"// Ensure Configuration is defined before building\ndotnet build -p:Configuration=Debug\n// or, in a custom host, seed GeneratorOptions MSBuildProperties[\"Configuration\"] = \"Debug\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build through dotnet/MSBuild so Configuration is set.","When driving the generator programmatically, seed Configuration in the MSBuild properties."],"tags":["msbuild","source-generator","build-config","configuration","native-ctor"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}