{"record":{"id":"78c8463bf4b652f0","repo":"microsoft/aspire","slug":"managedclusterproperties-ingressprofile-not-found-via","errorCode":null,"errorMessage":"ManagedClusterProperties.IngressProfile not found via reflection. The Azure.Provisioning surface may have changed; review AksPreviewIngressProfileInjector.","messagePattern":"ManagedClusterProperties\\.IngressProfile not found via reflection\\. The Azure\\.Provisioning surface may have changed; review AksPreviewIngressProfileInjector\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.Kubernetes/AksPreviewIngressProfileInjector.cs","lineNumber":172,"sourceCode":"            enabled.Assign(true);\n        }\n    }\n\n    private static object GetIngressProfileInstance(ContainerServiceManagedCluster aks)\n    {\n        // ContainerServiceManagedCluster.Properties is internal and exposes the\n        // ManagedClusterProperties complex object that owns IngressProfile (also internal).\n        var clusterPropsProp = typeof(ContainerServiceManagedCluster).GetProperty(\n            \"Properties\",\n            BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)\n            ?? throw new InvalidOperationException(\"ContainerServiceManagedCluster.Properties not found via reflection. The Azure.Provisioning surface may have changed; review AksPreviewIngressProfileInjector.\");\n        var clusterProps = clusterPropsProp.GetValue(aks)\n            ?? throw new InvalidOperationException(\"ContainerServiceManagedCluster.Properties returned null.\");\n\n        var ipProp = clusterProps.GetType().GetProperty(\n            \"IngressProfile\",\n            BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)\n            ?? throw new InvalidOperationException(\"ManagedClusterProperties.IngressProfile not found via reflection. The Azure.Provisioning surface may have changed; review AksPreviewIngressProfileInjector.\");\n        var ipInstance = ipProp.GetValue(clusterProps)\n            ?? throw new InvalidOperationException(\"ManagedClusterProperties.IngressProfile was null even after assigning IngressWebAppRouting; the Azure.Provisioning lazy-initialization behavior may have changed.\");\n\n        if (ipInstance.GetType().FullName != IngressProfileTypeFullName)\n        {\n            throw new InvalidOperationException($\"Expected IngressProfile to be a {IngressProfileTypeFullName} but found {ipInstance.GetType().FullName}.\");\n        }\n\n        return ipInstance;\n    }\n}\n","sourceCodeStart":154,"sourceCodeEnd":184,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.Kubernetes/AksPreviewIngressProfileInjector.cs#L154-L184","documentation":"After obtaining the internal ManagedClusterProperties instance, the injector reflects for its IngressProfile property; if GetProperty(\"IngressProfile\", Public|NonPublic|Instance) finds nothing, this error is thrown. It guards the reflection contract that ManagedClusterProperties owns an IngressProfile complex object, which is the target construct on which the preview gatewayAPI/applicationLoadBalancer Bicep entries are defined.","triggerScenarios":"AksPreviewIngressProfileInjector.Inject is called with gatewayApi or applicationLoadBalancer enabled, and the installed Azure.Provisioning.ContainerService version renamed, removed, or restructured the IngressProfile property on ManagedClusterProperties (e.g. moved it or split it into separate typed properties).","commonSituations":"Upgrading Azure.Provisioning.ContainerService beyond the beta Aspire pinned; a transitive package bump in azure-sdk-for-net betas; running an older/newer Aspire build against a newer provisioning package where the ingress model was reshaped.","solutions":["Pin Azure.Provisioning.ContainerService to 1.0.0-beta.6 in Directory.Packages.props until upstream exposes ManagedClusterIngressProfile publicly","If the new version exposes IngressProfile (or GatewayApi/ApplicationLoadBalancer) as public typed properties, replace the reflection injector with the standard public-subclass extension pattern and delete the reflection code","If the property was renamed in the installed version, update the GetProperty(\"IngressProfile\", ...) lookup in GetIngressProfileInstance to the new member name","Clear NuGet caches and restore to rule out a stale assembly, then confirm with dotnet list package --include-transitive that only one Azure.Provisioning.ContainerService version is bound","Track microsoft/aspire#17060 and Azure/azure-sdk-for-net#59225 for the proper upstream fix"],"exampleFix":"// before\nvar ipProp = clusterProps.GetType().GetProperty(\"IngressProfile\", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)\n    ?? throw new InvalidOperationException(\"...IngressProfile not found...\");\n// after (if upstream made it public with a new typed accessor)\nvar ingressProfile = ((ContainerServiceManagedCluster)aks).IngressProfile\n    ?? throw new InvalidOperationException(\"IngressProfile unavailable in this Azure.Provisioning version.\");","handlingStrategy":"fallback","validationCode":"var ipProp = typeof(object).Assembly\n    .GetTypes().Where(t => t.FullName == \"Azure.Provisioning.ContainerService.ManagedClusterProperties\")\n    .Select(t => t.GetProperty(\"IngressProfile\", BindingFlags.Public | BindingFlags.NonPublic | Instance))\n    .FirstOrDefault();\nif (ipProp is null)\n{\n    throw new InvalidOperationException(\"ManagedClusterProperties.IngressProfile is unavailable; pin Azure.Provisioning.ContainerService 1.0.0-beta.6 or use the typed public API.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    AksPreviewIngressProfileInjector.Inject(aks, gatewayApi, applicationLoadBalancer);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"IngressProfile not found\"))\n{\n    throw new InvalidOperationException($\"Installed Azure.Provisioning.ContainerService no longer exposes ManagedClusterProperties.IngressProfile; preview AKS ingress features cannot be injected. Pinned version required.\", ex);\n}","preventionTips":["Pin Azure.Provisioning.ContainerService to 1.0.0-beta.6 until ManagedClusterIngressProfile is public","Review azure-sdk-for-net ContainerService breaking-change notes before every package upgrade","Keep the reflection member names ('Properties', 'IngressProfile') in one small, tested place so drift fixes are single-line","Add a unit test asserting the reflection lookups resolve so package drift is caught in CI","Migrate to the typed public API as soon as aspire#17060 / Azure#59225 land upstream"],"tags":["reflection","azure","aks","azure-provisioning","version-incompatibility"],"backgroundTag":"class-not-found","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"}