{"record":{"id":"35bb34c4623c1b13","repo":"microsoft/aspire","slug":"the-property-property-is-not-supported-for-the-endpoint-35bb34","errorCode":null,"errorMessage":"The property '{property}' is not supported for the endpoint '{endpoint.Name}'.","messagePattern":"The property '(.+?)' is not supported for the endpoint '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/ApplicationModel/IComputeEnvironmentResource.cs","lineNumber":64,"sourceCode":"        var endpoint = endpointReference.EndpointAnnotation;\n        var scheme = endpoint.UriScheme;\n        var port = endpoint.Port ?? GetDefaultPort(scheme, endpoint);\n        var host = new Lazy<ReferenceExpression>(() => GetHostAddressExpression(endpointReference));\n\n        return property switch\n        {\n            EndpointProperty.Url => IsDefaultPort(scheme, port)\n                ? ReferenceExpression.Create($\"{scheme}://{host.Value}\")\n                : ReferenceExpression.Create($\"{scheme}://{host.Value}:{port.ToString(CultureInfo.InvariantCulture)}\"),\n            EndpointProperty.Host or EndpointProperty.IPV4Host => host.Value,\n            EndpointProperty.Port => ReferenceExpression.Create($\"{port.ToString(CultureInfo.InvariantCulture)}\"),\n            EndpointProperty.TargetPort => endpoint.TargetPort is int targetPort\n                ? ReferenceExpression.Create($\"{targetPort.ToString(CultureInfo.InvariantCulture)}\")\n                : ReferenceExpression.Create($\"{new ContainerPortReference(endpointReference.Resource)}\"),\n            EndpointProperty.Scheme => ReferenceExpression.Create($\"{scheme}\"),\n            EndpointProperty.HostAndPort => ReferenceExpression.Create($\"{host.Value}:{port.ToString(CultureInfo.InvariantCulture)}\"),\n            EndpointProperty.TlsEnabled => ReferenceExpression.Create($\"{(endpoint.TlsEnabled ? bool.TrueString : bool.FalseString)}\"),\n            _ => throw new InvalidOperationException($\"The property '{property}' is not supported for the endpoint '{endpoint.Name}'.\")\n        };\n    }\n\n    private static int GetDefaultPort(string scheme, EndpointAnnotation endpoint)\n    {\n        if (string.Equals(scheme, \"http\", StringComparison.OrdinalIgnoreCase))\n        {\n            return 80;\n        }\n\n        if (string.Equals(scheme, \"https\", StringComparison.OrdinalIgnoreCase))\n        {\n            return 443;\n        }\n\n        throw new InvalidOperationException($\"Endpoint '{endpoint.Name}' must specify a port for scheme '{scheme}'.\");\n    }\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/ApplicationModel/IComputeEnvironmentResource.cs#L46-L82","documentation":"GetEndpointPropertyExpression maps an EndpointProperty enum to a ReferenceExpression for compute-environment resources (e.g. container apps). The switch's default arm throws InvalidOperationException when the requested property has no mapping for the given endpoint, meaning the property is not supported on that endpoint/resource combination.","triggerScenarios":"Calling the extension that builds an endpoint property expression (GetEndpointProperty overloads on IComputeEnvironmentResource) with an EndpointProperty value the implementation does not handle for the endpoint — typically newer enum members like IsExternal or Tls variants evaluated against endpoints/resources lacking that state.","commonSituations":"Version skew: custom environment resource or older integration compiled against fewer EndpointProperty members while a newer core enum value is requested; hand-writing manifest generation code that requests an exotic property.","solutions":["Only request EndpointProperty members your compute environment supports; guard unknown properties before calling.","Update the Aspire.Hosting packages so the resource's implementation handles the enum member being requested.","Add a case to the switch in a custom IComputeEnvironmentResource implementation for the unsupported property.","Catch InvalidOperationException at manifest-generation time and fall back to an explicit value or skip the property."],"exampleFix":"// before\nvar expr = envResource.GetEndpointPropertyExpression(endpoint, EndpointProperty.Host); // unsupported for this env\n// after\nif (endpoint.IsExternal || /* property supported for this env */ true)\n{\n    var expr = envResource.GetEndpointPropertyExpression(endpoint, supportedProperty);\n}","handlingStrategy":"try-catch","validationCode":"// only request supported properties\nstatic bool IsSupported(EndpointProperty p) => p is\n    EndpointProperty.Host or EndpointProperty.Port or EndpointProperty.TargetPort or\n    EndpointProperty.Scheme or EndpointProperty.HostAndPort or EndpointProperty.TlsEnabled;","typeGuard":null,"tryCatchPattern":"try\n{\n    var expr = env.GetEndpointPropertyExpression(endpoint, property);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"is not supported for the endpoint\"))\n{\n    // skip the property or emit a literal value in the manifest\n}","preventionTips":["Keep Aspire.Hosting core and compute-environment integration package versions aligned.","Restrict manifest-generation code to EndpointProperty members your environment implements.","When implementing a custom IComputeEnvironmentResource, cover every EndpointProperty member (or a safe default) and re-check after core updates.","Add tests enumerating all EndpointProperty values against your environment implementation."],"tags":["dotnet","aspire","endpoints","compute-environment","manifest"],"backgroundTag":"unsupported-operation","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"}