{"record":{"id":"b87909ba32ccf5f6","repo":"microsoft/aspire","slug":"builder-gettype-fullname-is-missing-appendvalueprovider","errorCode":null,"errorMessage":"'{builder.GetType().FullName}' is missing AppendValueProvider(object, string).","messagePattern":"'(.+?)' is missing AppendValueProvider\\(object, string\\)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.RemoteHost/Ats/ReferenceExpressionRef.cs","lineNumber":347,"sourceCode":"            \"AppendLiteral\",\n            BindingFlags.Instance | BindingFlags.Public,\n            binder: null,\n            [typeof(string)],\n            modifiers: null)\n            ?? throw new InvalidOperationException($\"'{builder.GetType().FullName}' is missing AppendLiteral(string).\");\n\n        appendLiteralMethod.Invoke(builder, [value]);\n    }\n\n    private static void AppendValueProvider(object builder, object valueProvider)\n    {\n        var appendValueProviderMethod = builder.GetType().GetMethod(\n            \"AppendValueProvider\",\n            BindingFlags.Instance | BindingFlags.Public,\n            binder: null,\n            [typeof(object), typeof(string)],\n            modifiers: null)\n            ?? throw new InvalidOperationException($\"'{builder.GetType().FullName}' is missing AppendValueProvider(object, string).\");\n\n        appendValueProviderMethod.Invoke(builder, [valueProvider, null]);\n    }\n\n    private static object BuildReferenceExpression(object builder)\n    {\n        var buildMethod = builder.GetType().GetMethod(\"Build\", BindingFlags.Instance | BindingFlags.Public)\n            ?? throw new InvalidOperationException($\"'{builder.GetType().FullName}' is missing Build().\");\n\n        return buildMethod.Invoke(builder, null)\n            ?? throw new InvalidOperationException($\"'{builder.GetType().FullName}.Build()' returned null.\");\n    }\n\n    private static object CreateConditionalReferenceExpression(\n        object condition,\n        string matchValue,\n        object whenTrue,\n        object whenFalse)","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.RemoteHost/Ats/ReferenceExpressionRef.cs#L329-L365","documentation":"AppendValueProvider reflectively requires a public instance AppendValueProvider(object, string) method on the builder. When reflection cannot find that exact signature, this InvalidOperationException is thrown with the builder's type name.","triggerScenarios":"ToValueReferenceExpression calls AppendValueProvider(builder, valueProvider) and GetMethod(\"AppendValueProvider\", Public|Instance, [typeof(object), typeof(string)]) returns null.","commonSituations":"Aspire.Hosting version change altered the AppendValueProvider signature or overloads; wrong object passed as builder; trimming stripped the method in AOT-published apps.","solutions":["Pass the ReferenceExpression.Builder instance (un-built) as the builder argument.","Align Aspire.Hosting versions so Builder.AppendValueProvider(object, string) exists.","If publishing trimmed, add a trimmer root/DynamicDependency for ReferenceExpression.Builder.","Check the referenced Aspire.Hosting README/changelog for signature changes to AppendValueProvider."],"exampleFix":"// before\nAppendValueProvider(builtExpression, valueProvider); // built expression lacks Builder methods\n\n// after\nvar builder = CreateReferenceExpressionBuilder();\nAppendValueProvider(builder, valueProvider);","handlingStrategy":"type-guard","validationCode":"var m = builder.GetType().GetMethod(\"AppendValueProvider\", BindingFlags.Instance | BindingFlags.Public, null, [typeof(object), typeof(string)], null);\nif (m is null)\n    throw new NotSupportedException($\"{builder.GetType().FullName} lacks AppendValueProvider(object, string); check Aspire.Hosting version.\");","typeGuard":"static bool SupportsAppendValueProvider(object builder) =>\n    builder.GetType().GetMethod(\"AppendValueProvider\", BindingFlags.Instance | BindingFlags.Public, null, [typeof(object), typeof(string)], null) is not null;","tryCatchPattern":"try\n{\n    AppendValueProvider(builder, valueProvider);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"missing AppendValueProvider\"))\n{\n    logger.LogError(ex, \"Builder surface mismatch on {Type}\", builder.GetType().FullName);\n}","preventionTips":["Verify the value provider is appended on an un-built ReferenceExpression.Builder.","Read the Aspire.Hosting changelog when bumping versions — AppendValueProvider signatures have evolved.","Keep integration tests covering value-provider interpolation paths.","Add trimming annotations for the builder methods in AOT scenarios."],"tags":["reflection","reference-expression","missing-method"],"backgroundTag":"method-not-implemented","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}